diff --git a/SRB2.cbp b/SRB2.cbp index 628e7da30..4834563ec 100644 --- a/SRB2.cbp +++ b/SRB2.cbp @@ -33,7 +33,7 @@ HW3SOUND for 3D hardware sound support - + @@ -56,7 +56,7 @@ HW3SOUND for 3D hardware sound support - + @@ -77,7 +77,7 @@ HW3SOUND for 3D hardware sound support - + @@ -107,7 +107,7 @@ HW3SOUND for 3D hardware sound support - + @@ -138,7 +138,7 @@ HW3SOUND for 3D hardware sound support - + @@ -185,7 +185,7 @@ HW3SOUND for 3D hardware sound support - + @@ -551,7 +551,7 @@ HW3SOUND for 3D hardware sound support - + @@ -592,7 +592,7 @@ HW3SOUND for 3D hardware sound support - + diff --git a/Srb2.dev b/Srb2.dev index 00b7811e1..21683e7c3 100644 --- a/Srb2.dev +++ b/Srb2.dev @@ -2228,7 +2228,7 @@ Includes=libs/libpng-src;libs/zlib;libs Libs=libs/libpng-src/projects;libs/zlib/win32;libs/miniupnpc/mingw32 ResourceIncludes=src/win32 MakeIncludes=comptime.mk;cpdebug.mk -Compiler=-DNDEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-Os_@@_-g_@@_-gdwarf-2_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DSDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_ +Compiler=-DNDEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-Os_@@_-g_@@_-gdwarf-2_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DHAVE_SDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_ CppCompiler=-Os_@@_-g_@@_-gdwarf-2_@@_ Linker=-lSDL_@@_-lSDL_Mixer_@@_-lpng32_@@_-lz32_@@_-lminiupnpc_@@_-lws2_32_@@_-liphlpapi_@@_-mconsole_@@_ PreprocDefines=NORMALSRB2_@@_ @@ -2305,7 +2305,7 @@ Includes=libs/libpng-src;libs/zlib;libs Libs=libs/libpng-src/projects;libs/zlib/win32;libs/miniupnpc/mingw32 ResourceIncludes=src/win32 MakeIncludes=comptime.mk;cpdebug.mk -Compiler=-D_DEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-O0_@@_-g_@@_-gdwarf-2_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DSDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_ +Compiler=-D_DEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-O0_@@_-g_@@_-gdwarf-2_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DHAVE_SDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_ CppCompiler=-O0_@@_-g_@@_-gdwarf-2_@@_ Linker=-lSDL_@@_-lSDL_Mixer_@@_-lpng32_@@_-lz32_@@_-lminiupnpc_@@_-lws2_32_@@_-liphlpapi_@@_-mconsole_@@_ PreprocDefines=NORMALSRB2_@@_ @@ -2386,7 +2386,7 @@ Includes=libs/libpng-src;libs/zlib;libs Libs=libs/libpng-src/projects;libs/zlib/win32;libs/miniupnpc/mingw64 ResourceIncludes=src/win32 MakeIncludes=comptime.mk;cpdebug.mk -Compiler=-DNDEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-Os_@@_-g_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DSDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_ +Compiler=-DNDEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-Os_@@_-g_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DHAVE_SDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_ CppCompiler=-Os_@@_-g_@@_ Linker=-lSDL_@@_-lSDL_Mixer_@@_-lpng64_@@_-lz64_@@_-lminiupnpc_@@_-lws2_32_@@_-liphlpapi_@@_-mconsole_@@_ PreprocDefines=NORMALSRB2_@@_ @@ -2413,7 +2413,7 @@ Includes=libs/libpng-src;libs/zlib;libs Libs=libs/libpng-src/projects;libs/zlib/win32;libs/miniupnpc/mingw64 ResourceIncludes=src/win32 MakeIncludes=comptime.mk;cpdebug.mk -Compiler=-D_DEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-O0_@@_-g_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DSDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_ +Compiler=-D_DEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-O0_@@_-g_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DHAVE_SDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_ CppCompiler=-O0_@@_-g_@@_ Linker=-lSDL_@@_-lSDL_Mixer_@@_-lpng64_@@_-lz64_@@_-lminiupnpc_@@_-lws2_32_@@_-liphlpapi_@@_-mconsole_@@_ PreprocDefines=NORMALSRB2_@@_ diff --git a/doc/manual/manual.htm b/doc/manual/manual.htm index 57e9bb0c9..bdf4d2a98 100644 --- a/doc/manual/manual.htm +++ b/doc/manual/manual.htm @@ -1,2393 +1,68 @@ - + Sonic Robo Blast 2 Manual - + + +

- title.png (43991 bytes) + SONIC +
+ ROBO BLAST 2

Manual

-

- Design and content on SRB2 is copyright 1998-2009 by Sonic Team Junior. - All non-original material in this game is copyrighted by their respective - owners, and no copyright infringement is intended. This game's staff make - no profit whatsoever (in fact, we lose money). THIS GAME - SHOULD NOT BE SOLD FOR ANY COST WHATSOEVER! Sonic Team - Junior is in no way affiliated with Sega or Sonic Team. -

-
- -
-

- thanks.png (8396 bytes)Thank you for installing SRB2! This fan - created tribute game to one of the greatest video game series has - been over 11 years in the making. Before you begin play, please note the - system requirements below to make sure you have an enjoyable experience. -

-

- - System Requirements -

-

- Minimum Spec (320x200): -

-
    -
  • Intel Pentium II 400mhz or better* -
  • -
  • 64mb RAM -
  • -
  • 200mb free disk space (2mb free during play) -
  • -
  • DirectX 3 or better compliant video -
  • -
  • DirectX 3 compliant sound -
  • -
-

- Recommended Spec (640x400): -

-
    -
  • Intel or AMD 700mhz or better* -
  • -
  • 64mb RAM -
  • -
  • 200mb free disk space (2mb free during play) -
  • -
  • DirectX 3 or better compliant video -
  • -
  • DirectSound compatible sound card -
  • -
-

- SRB2 will run on lesser machines, but is generally not recommended. -

-

-

-
-

- - Items -

-

- There are many items you will encounter throughout the game that Sonic - and his friends can use to their advantage. Below is a short summary of - the most common ones you will find. -

-

-

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- Ring0000.png (1178 bytes) -

-
- Ring -

- The main lifeline for Sonic & Co. Your collection of rings - will scatter when hit, but as long as you have one, you cannot be - killed (except from a pit or crusher). -

-
- ring.png (1109 bytes) - - 10 Ring Box -

- Adds 10 rings to your cache -

-
- wshield.png (1114 bytes) - - Whirlwind Shield -

- Protects you from one hit. Press the spin button while jumping to - perform a second jump. Beware, though, as the second jump stops - you from spinning. -

-
- yshield.png (1112 bytes) - - Attraction Shield -

- Protects you from one hit. This will attract nearby rings. Don't - go too deep in the water, or you'll short it out! -

-
- bshield.png (1113 bytes) - - Force Shield -

- Protects you from two hits. It has a reflect ability that is automatically - activated when it gets hit. -

-
- gshield.png (1113 bytes) - - Elemental Shield -

- Protects you from one hit. This protects you from the elements, keeps - you from drowning, and creates a flaming trail when you spindash that - will damage your enemies! -

-
- rshield.png (1110 bytes) - - Armaggeddon Shield -

- Protects you from one hit. When you get hit, the shield will - explode, wiping out all enemies within its blast radius, - destroying the shield. The explosion can be triggered by pressing - the spin button while jumping as well. -

-
- invc.png (1112 bytes) - - Invincibility -

- Makes you invincible for 20 seconds. -

-
- shoes.png (1118 bytes) - - Super Sneakers -

- Increases your speed for 20 seconds. -

-
- soneup.png (1118 bytes)
- soneup.png (1118 bytes)
- soneup.png (1118 bytes) -
- One-Up -

- Gives you an extra life. In match and CTF, it gives you 100 rings. -

-
- mixup.png (1162 bytes) - - Teleporter Scramble -

- In multiplayer, this will scramble the positions of all players - in the game. -

-
- recycler.png (1230 bytes) - - Recycler -

- In multiplayer, this will scramble all of the players' powerups. - This includes ammo, powerups, and weapons. -

-
- eggbox.png (1157 bytes) - - Eggman -

- Harms your player. Watch out! -

-
- random.png (1105 bytes) - - Random Item -

- What's in the box? Only way to find out is to open it! -

-
- token.png (1122 bytes) - -

- Warp Token -

-

- At the end of the act, you will be taken to a special stage, - giving you the chance to snatch one of the Chaos Emeralds back - from Dr. Eggman's grasp! There are at least one of these in each - act. -

-
- emblem.png (1368 bytes) - - Emblem -

- These are hidden in every act, except ones where you have to - confront Eggman. Different ones appear depending on which - character you play as. Getting enough of these will unlock - special bonuses! You may obtain more by meeting special criteria, - such as completing the game with all of the chaos emeralds. When - you've picked up these emblems, they will disappear. If you find - them again in a new game, they will be faded, indicating that you - have already obtained that emblem. Check the statistics to see - which emblems are missing from your collection. -

-
-

- In CTF, there are team based rings and monitors. -

-

- red_ring.png (1219 bytes) - red_monitor.png (1199 bytes) - blue_ring.png (1218 bytes) - blue_monitor.png (1160 bytes) -

-
-
-
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- Special Multiplayer Items -

-

- In certain multiplayer games, you can use the following match weapons - to change the kind of rings you throw. Make sure you grab the weapon, - the ammo, and have rings or else it won't fire. -

-
-

- red_ring.png (1219 bytes) -

-
-

- Red Ring (Default Weapon) -

-

- This is your default weapon. It can't be dropped and it uses normal rings - for ammo. -

-
-

- wpnpanel_auto.png (1399 bytes) - RNGA0000.png (1100 bytes) -

-
-

- Automatic -

-

- Hold down the THROW key for a constant stream of rings. -

-
-

- wpnpanel_bounce.png (1533 bytes) - RNGB0000.png (1275 bytes) -

-
-

- Bounce -

-

- When fired, the bounce ring acts like a normal red ring, except that - it will bounce off walls, ceilings, and floors for a bit before disappearing. - Great for firing around corners and in small rooms. -

-
-

- wpnpanel_explosion.png (1359 bytes) - RNGE0000.png (1326 bytes) -

-
-

- Explosion -

-

- When this ring hits a wall, it scatters rings everywhere in a - fireworks-like display. Players hit directly by the black ring - get knocked back farther than normal. -

-
-

- wpnpanel_grenade.png (1455 bytes) - RNGG0000.png (1227 bytes) -

-
-

- Grenade -

-

- Fires a grenade that explodes by proximity. Great for guarding CTF - bases and for chucking in places where you expect the opponent will run. -

-
-

- wpnpanel_rail.png (1489 bytes) - RNGR0000.png (1163 bytes) -

-
-

- Rail -

-

- Snipe at your enemies with this instant-hit weapon! Players hit - with this weapon get knocked back farther than normal. -

-
-

- wpnpanel_scatter.png (1370 bytes) - RNGS0000.png (1127 bytes) -

-
-

- Scatter -

-

- Fires 5 rings that spread out as they go farther. The distance the - opponent flies when hit varies depending on how far the shot traveled - in the air. At point-blank range, scatter will send the opponent - flying across the stage, leaving their items easily taken. -

-
-

- WARNING! -

-

- metal.png (5951 bytes) -

-

- If you are hit while carrying any of these special rings, they - will be dropped. Pick them up quickly to keep your opponents from - stealing them! -

-
-
-
-
-

- - Special Moves -

-

- Sonic and his friends each have abilities unique to themselves. Below is - a summary of each character's special moves. -

-

-

-
- - - - - - - - - - -
-

- Sonic -

-
-

- airspin.png (4279 bytes) -

-
- Air Spin Attack -

- While jumping, press the jump button again to hurl Sonic forward - in a burst of speed. -

-
-
-
-
- - - - - - - - - - - - - -
-

- Tails -

-
-

- tailsfly.png (18615 bytes) -

-
- Fly -

- While jumping, press the jump button repeatedly to fly for a - short time. If you are playing with a friend, fly over them to - pick them up for a ride! -

-
- Swim -

- While underwater, press the jump button repeatedly to swim for a - short time. Just like flying, you can pick up others to give them - a lift. -

-
-
-
-
- - - - - - - - - - - - - -
-

- Knuckles -

-
-

- knuckles.png (16482 bytes) -

-
- Glide -

- While jumping, press and hold the jump button again to glide. Use - the directional keys to steer. -

-
- Climb -

- If you collide with a wall while gliding, Knuckles will latch - onto it. Use the directional keys to move along the wall. Press - the jump button to release and turn around, or press the spin - button to release while still facing the wall. -

-
-
-
-
-

- - Basic Gameplay -

-
- - - - - - - - - - - - - - - - - - - - - - - -
-

    Your main objective is to stop Eggman's plans for world - domination. The game is set over eight zones ranging from green - fields and ancient sunken cities to raging volcanoes and the Egg - Rock itself. Each zone is split up into three acts, the third one - being a battle against Dr. Eggman in one of his powerful machines.

-
-

- eggman.png (12925 bytes) -

-
-

- attack.png (3880 bytes) -

-
-

    When you encounter enemies, to defeat them, simply use your - spin attack by jumping. Enemies can also be destroyed by spinning - through them along the ground. Knuckles can even glide through his - enemies.

-
-

    However, beware! You are not invulnerable and, unless you have - at least one ring, an enemy will kill you on contact, or if you are - hit by one of their attacks. If you get hit by an enemy while you - have rings, you will survive, but your rings will be dropped and - scattered. You can pick them back up again, but only if you are - quick; rings will dissapear after a few seconds have elapsed! You - can find out how many rings you have in the top-left hand part of - the screen.

-
-

- stats_rings.png (19450 bytes) -

-
-

- wshield.png (1114 bytes) - yshield.png (1112 bytes) - bshield.png (1113 bytes) - gshield.png (1113 bytes) - rshield.png (1110 bytes) -

-
-

    You can also obtain shields, which will dissapate to protect - you if you are hit by a robot or an attack. Some shields have - additional powers, which were described above, along with other - power-ups you can obtain.

-
-

    Getting killed by a robot or by other hazards (described below) - will result in the loss of one life - keep an eye on your lives in - the bottom left hand side of the screen - losing all of your lives - will end your game (unless you have a continue)!

-
-

- stats_lives.png (19359 bytes) -

-
-
-
-
-

- - Surroundings -

-

- The following is a description of several objects or environments you - will encounter. -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- spring1.png (941 bytes) - spring2.png (941 bytes) - spring3.png (1071 bytes) - spring4.png (1046 bytes) -

-

- spring5.png (1107 bytes) - spring6.png (1138 bytes) - spring7.png (940 bytes) - spring8.png (940 bytes) -

-
-

- Springs -

-

- These springs will bounce you in the direction they are pointing. - There are two varieties, yellow and red. The red spring is much - stronger than the yellow spring. Beware though, as some springs - may throw you headlong into trouble! -

-
-

- platform.png (47948 bytes) -

-
-

- Floating Platforms -

-

- These platforms may move up and down, allowing you to hitch a - ride. Careful timing may be needed to leap from one platform to - the next. -

-
-

- fan.png (1089 bytes) -

-
-

- Fans -

-

- Powerful fans swirl around at a high speed and produces a power - blast of wind. It is advised to be careful on these, as it is - easy to go flying off the fans and into danger! -

-
-

- conveyor.png (59401 bytes) -

-
-

- Conveyor Belts -

-

- Found in most of Eggman's factories, these conveyor belts are - used to quickly transport robotic components and robots. While - you can also make use of them, be alert! Eggman has changed the - movements of them to lead an unwary player into a trap! -

-
-

- water.png (33687 bytes) -

-
-

- Water -

-

- All three characters can go underwater, but movement is greatly - slowed down, and only Tails can swim. Bear in mind that you - cannot breathe while you are underwater and must make use of the - air pockets that are found bubbling out of cracks in the floor. A - countdown will appear if you are dangerously close to running out - of air. If time runs out, you will drown and lose a life. -

-
-

- slime.png (67845 bytes) -

-
-

- Slime -

-

- This is largely predominant in zones where Eggman has been at - work, such as the Techno Hill Zone. You can wade in it, but don't - get in too deep! The only way to safely swim is with an elemental - shield. -

-
-

- crusher.png (49485 bytes) -

-
-

- Crushers -

-

- These traps are lethal and will immediately kill anyone trapped - under one - even invincibility will not protect you here. -

-
-

- pit.png (5508 bytes) -

-
-

- Deep Pits -

-

- Like crushers, these traps immediately take one life and - invincibility is useless. -

-
-
-
-
-

- - Multiplayer -

-

- Not only can you play SRB2 alone, but with a network connection, your - friends as well! -

-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- coop.png (11051 bytes) -

-

- Co-Op -

-
- Similar to a single player game, you can play through the single - player levels together. Up to 32 players allowed, but a maximum of - 8 is suggested. -
-

- match.png (7565 bytes) -

-

- Match -

-
- It's a free for all, and the one with the most points wins! Run - around picking up rings to hurl at your opponent. Points are given - depending on the status of your target:
-
    -
  • Rings or Shield - 50 pts. -
  • -
  • No Rings or Shield - 100 pts. -
  • -
-

- The player with the most points at the end of the round wins the - round.
-
- Press the "Rankings" key to view scores. Up to a maximum of 32 - players allowed. -

-
-

- match.png (7565 bytes) -

-

- Team Match -

-
- It's a team based fight to the finish. Play match with teammates, - and the team with the biggest total score wins. Scoring is the same - as match mode.
-
- Press the "Rankings" key to view scores. Up to a maximum of 32 - players allowed. -
-

- race.png (5364 bytes) -

-

- Classic Race -

-
- Just like Sonic 2's split screen mode, each player must race to the - end of the level. At the end of the stage, players will be ranked - based on the following five categories:
-
    -
  • Score - The player with the most points wins this category. -
  • -
  • Time - The player who beat the stage the fastest wins this - category. -
  • -
  • Ring - The player who completed the stage with the most rings - wins this category. -
  • -
  • Total Ring - The player who picked up the most rings wins - this category. Rings lost to enemies and hazards still count - towards this score. -
  • -
  • Item Box - The player who broke the most powerup monitors - wins this category. -
  • -
-

- When one player has completed the stage, the rest of the players - in the game have 60 seconds to complete the stage or they will - die and the round will end. The player who wins the most - categories wins the round. -

-
-

- race.png (5364 bytes) -

-

- Race -

-
- Just like Sonic 3's split screen mode, each player must race to the - end of the level. When one player has completed the stage, the rest - of the players in the game have 60 seconds to complete the stage or - they will die and the round will end. Best time wins! -
-

- tag.png (11057 bytes) -

-

- Tag -

-
- You're it! Up to 32 people can play in this touch-and-run frenzy! - One player is it, and can tag others either by throwing a ring, or - by touching them. You become it once you're hit. In some levels - there is a no-tag zone, but don't stay in there too long! You gain - points by avoiding a tag each time one occurs. -

- Press the "Rankings" key to view scores. Up to a maximum of 32 - players allowed. -

-
-

- ctf.png (8251 bytes) -

-

- Capture the Flag -

-
- Just like the popular FPS game, but with a platforming twist! - Choose a team - Red or Blue. Grab the opposing team's flag and - bring it back to your base while your own team's flag is in the - base to score a point. -

- Press the "Rankings" key to view scores. Up to a maximum of 32 - players allowed. -

-
-
-
-

- You'll notice that in the LEVEL NAME, after the level, are letters in - parenthesis. This tells you what kind of level it is. -

-

- C = Cooperative/Single Player -

-

- R = Race/Classic Race -

-

- M = Match/Team Match -

-

- T = Tag -

-

- F = Capture the Flag -

-

- - Special Multiplayer Console Commands -

-

- Multiplayer can make heavy use of the console, and you may find several - commands to your advantage. Please refer to the Console Command - Summary below. -

-

- SRB2 uses ports 5029 and 5030 for network communication using the UDP - protocol. -

-
-

- - Zones
-

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- gfz.png (19494 bytes) -

-
- GREENFLOWER ZONE -
- Sonic and friends immediately set out for the Greenflower Zone. - Luckily, you've reached this green haven before Eggman has had a - chance to completely take control. Whilst exploring this level, - keep your eyes peeled for anything hidden among the foilage... - including robots! -
-

- thz.png (23896 bytes) -

-
- TECHNO HILL ZONE -
- Once a beautiful landscape, Eggman has turned this into a - slime-ridden mess. You'll eventually reach the factory, and once - inside, you'll have to negotiate lasers and crushers that have been - installed to stop your progress. Finally, a battle will ensue on a - high speed rail cart... -
-

- dsz.png (32144 bytes) -

-
- DEEP SEA ZONE -
- Sonic, Tails and Knuckles stumble upon some ruins, which have been flooded, - partly by nature and partly by Eggman digging for the Chaos Emeralds. Be - wary of water traps which can threaten to drown you! -
-

- cez.png (36151 bytes) -

-
- CASTLE EGGMAN ZONE -
- Having retreated here, Sonic, Tails and Knuckles must launch a - full-scale assault on this castle and defeat Eggman, who is - residing in the lower levels. Not only is this castle guarded by a - huge wall, but Eggman has laid several traps inside that will catch - you off guard! -
-

- acz.png (43670 bytes) -

-
- ARID CANYON ZONE -
- Having escaped Eggman's stronghold, you come across a huge canyon. - While Sonic must find a way to cross this, Tails and Knuckles can use - their abilites to the fullest. Be careful not to enjoy the scenery too - much, as there are plenty of falling platforms and obstacles. -
-

- rvz.png (45020 bytes) -

-
- RED VOLCANO ZONE -
- Finding Eggman's robots entering the volcano, you follow them to - investigate what's happening. Rather than worrying about Eggman's - traps here, you should be more concerned with the deadly lava, that - threatens to rise without warning. -
-

- unknown.png (546 bytes) -

-
- EGG ROCK ZONE -
- You've finally arrived at the Eggrock Zone. Who knows what's in here? - Except for a few surprises, maybe. -
-

- unknown.png (546 bytes) -

-
- ??? -
- More hidden levels are waiting to be unlocked... can you find them? -
-
-
-

- -

-
-

- - Controls -

-

- The following are the default controls and their definition. You can - change the controls by going to Options/Setup Controls in the menu. Player 2's controls - can be changed as well. -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Forward -

- Default Key: Up Or W -

-
- Moves your player forward. -
- Reverse -

- Default Key: Down Or S -

-
- Moves your player in reverse. -
- Turn Left -

- Default Key: Left -

-
- Turns your player left. -
- Turn Right -

- Default Key: Right -

-
- Turns your player right. -
- Jump -

- Default Key: Z Or Mouse2 -

-
- Makes your player jump. -
- Spin -

- Default Key: X -

-
- If standing still, this will rev a spindash. If you are moving and - on the ground, you will go into a spin. -
- Ring Toss -

- Default Key: RCTRL Or Mouse1 -

-
- If in a multiplayer game that permits it, this button throws a - ring. -
- Ring Toss Normal -

- Default Key: C -

-
- If in a multiplayer game that permits it, this button will throw a - normal ring, whether you have special weapons or not. -
- Taunt -

- Default Key: V -

-
- If in a multiplayer game, this key throws one of four random taunts - at your opponents, providing they exist for your character. Sonic, - Tails, and Knuckles do not have taunts. -
- Toss Flag -

- Default Key: ' (Apostrophe) -

-
- Press this key to throw a flag - you are carrying (Capture the Flag). -
- Strafe On -

- Default Key: RALT -

-
- Hold this down to use the Left and Right keys to strafe. -
- Strafe Left -

- Default Key: A -

-
- Makes your player sidestep to the left. -
- Strafe Right -

- Default Key: D -

-
- Makes your player sidestep to the right. -
- Look Up -

- Default Key: PageUp -

-
- Tilts the camera upward. -
- Look Down -

- Default Key: PageDown -

-
- Tilts the camera downward. -
- Center View -

- Default Key: End -

-
- Centers the camera view. -
- Mouselook -

- Default Key: --- (No default key assigned) -

-
- When held down, use the mouse to move your view. -
- Talk Key -

- Default Key: T -

-
- Talk to other players in the game. -
- Team-Talk Key -

- Default Key: Y -

-
- Talk to team members in the game. -
- Rankings/Scores -

- Default Key: Tab -

-
- View current scores/statistics. -
- Console -

- Default Key: ~ (Tilde) -

-
- Brings down the console. For advanced users only. -
- Next Weapon -

- Default Key: E -

-
- Changes your weapon to the next one. -
- Previous Weapon -

- Default Key: Q -

-
- Changes your weapon to the previous one. -
- Weapon Slot 1 -

- Default Key: 1 -

-
- Changes your weapon to slot 1. -
- Weapon Slot 2 -

- Default Key: 2 -

-
- Changes your weapon to slot 2. -
- Weapon Slot 3 -

- Default Key: 3 -

-
- Changes your weapon to slot 3. -
- Weapon Slot 4 -

- Default Key: 4 -

-
- Changes your weapon to slot 4. -
- Weapon Slot 5 -

- Default Key: 5 -

-
- Changes your weapon to slot 5. -
- Weapon Slot 6 -

- Default Key: 6 -

-
- Changes your weapon to slot 6. -
- Weapon Slot 7 -

- Default Key: 7 -

-
- Changes your weapon to slot 7. -
- Rotate Camera L -

- Default Key: ( -

-
- Rotates the camera left. -
- Rotate Camera R -

- Default Key: ) -

-
- Rotates the camera right. -
- Reset Camera -

- Default Key: R -

-
- Resets the camera if it gets stuck. -
- Pause -

- Default Key: Pause/Break -

-
- Pauses the game. -
-
-
-

- - Joystick Setup -

-
- - - - - - - - - - -
-

- controls.png (22752 bytes) -

-
- You can also use a joystick with SRB2! Look in the controls menu - for a joystick menu to set it up! -
- If you have an analog joystick/gamepad, you are welcome to try the - "Analog Control" option in the Options menu. In collaboration with - the Rotate Camera L and R buttons, you may prefer this method of - control over the standard one. Available in single player and - split-screen, but not network games. -
-
-
-

- -

-
-

- - Console Command Summary -

-

- This is a general summary of some of the console commands that are in SRB2. - More information can be found on the website. -

-

- - Commands -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
- CONNECT <ip> - - Connects to the specified IP address. If no IP is specified, it - will search on the LAN for a game. -
- KICK <name or node #> - - Kicks a player in the current game (server only). -
- GETPLAYERNUM - - Lists all of the players in the game, their number in the array, - and their node #s. -
- SAVE <slot> <description> - - Saves your game. -
- LOAD <slot> - - Loads a saved game. -
- TUNES <slot> - - Temporarily changes the game music. -
- DISPLAYPLAYER - - Displays the number of the current player being displayed. -
- LISTSERV - - Retrieves a list of games currently running if the master list is - active. -
- NODES - - Lists all of the players in the game and their node #s. -
- SCREENSHOT - - Takes a screenshot of the game. Useful to bind a key to. -
- CHANGECONFIG <filename> - - Saves the current config and loads another. -
- LOADCONFIG <filename> - - Loads a new config without saving. -
- SAVECONFIG <filename> - - Saves the current configuration. -
- SETCONTROL -

- SETCONTROL2 -

-
- Manually changes the controls of 1P and 2P. See config.cfg for an - example. -
- CHATMACRO - - Type in HELP CHATMACRO for more information. -
- QUIT - - Exits the game. -
- PAUSE - - Pauses the game. -
- ADDFILE <filename> - - Adds a file to the game. -
- EXITLEVEL - - Exits the current level. -
- EXITGAME - - Exits the current game. -
- MAP MAPxx (01-99) - - Changes the level. -
- STOPDEMO - - Stops the currently running demo. -
- TIMEDEMO - - Plays back a demo at full speed. Useful for benchmarking. -
- PLAYDEMO - - Plays back a recorded demo. -
- CHANGETEAM x (RED or BLUE) - - Changes the current CTF team you are on. -
- BIND <key> <command> - - Binds a command to a key. -
- CLS - - Clears the console buffer. -
- TOGGLE - - Type HELP TOGGLE for more information -
- HELP - - Provides help. -
- WAIT - - Waits a certain number of game tics before executing the next - command. -
- EXEC <filename> - - Executes a console script. -
- ECHO - - Echos whatever you type. -
- ALIAS - - Creates an alias. Type HELP ALIAS for more information. -
- SAYTEAM <message> - - Sends a message to your team. -
- SAYTO <playername> <message> - - Sends a message to this player. -
- SAY <message> - - Sends a message to everyone. -
- MEMFREE - - Displays memory usage statistics. -
+ +
+ +
+ +
-
-
-

- - Variables -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- SV_MAXPLAYERS (on/off) - - Sets the maximum number of players allowed to be in this game. -
- SV_ALLOWNEWPLAYERS (on/off) - - Allow new players to join instantly or not. Setting this to NO - forces them to wait until the next map change. -
- SURROUND (on/off) - - Toggles DirectSound3D acceleration. -
- PRECACHESOUND (on/off) - - Tells the game to precache sound or not before playing. -
- STEREOREVERSE (on/off) - - Toggles reverse stereo mode. -
- CAM_ROTSPEED <integer> -

- CAM2_ROTSPEED <integer> -

-
- Changes the rotation speed of the camera. -
- CAM_ROTATE <integer> -

- CAM2_ROTATE <integer> -

-
- Changes the angle of the camera's rotation. -
- CAM_SPEED <integer> -

- CAM2_SPEED <integer> -

-
- Changes the speed of the camera. -
- CAM_HEIGHT <integer> -

- CAM2_HEIGHT <integer> -

-
- Changes the height of the camera. -
- CAM_STILL (on/off) -

- CAM2_STILL (on/off) -

-
- Forces the camera angle to freeze in place. -
- CAM_DIST <integer> -

- CAM2_DIST <integer> -

-
- Changes the distance of the camera. -
- ALLOWMLOOK - - Allow players to mouselook in a netgame (server only) -
- SONICCD (on/off) - - An alternate mode of death for enemies. -
- CHASECAM (on/off) -

- CHASECAM2 (on/off) -

-
- Turns the camera on and off. -
- GRAVITY <decimal value> - - Changes the gravity when allowed. -
- TRANSLUCENCY (on/off) - - Turns sprite translucency on and off. -
- SND_CHANNELS <integer> - - Sets the number of sound channels. -
- MUSICVOLUME <integer> - - Changes the music volume. -
- SOUNDVOLUME <integer> - - Changes the sound volume. -
- ALLOWTEAMCHANGE (yes/no) - - Allows players to change teams in CTF. (server only) -
- ALLOWAUTOAIM (yes/no) - - Allows players to use autoaim. (server only) -
- ALLOWEXITLEVEL (yes/no) - - Allows players to exit the level. (server only) -
- SHOWMESSAGES (on/off) - - Suppresses or enables some screen messages. -
- GAMMA <integer> - - Changes the gamma level. -
- COLOR <colorname> -

- COLOR2 <colorname> -

-
- Changes your player's color -
- NAME <name> -

- NAME2 <name> -

-
- Changes your player's name. -
- SKIN <name> -

- SKIN2 <name> -

-
- Changes your player's character. -
- FORCESKIN (on/off) - - Forces all players in the game to use the character that the server - is using. (server only) -
- PLAYDEMOSPEED <integer> - - Changes the speed at which a demo is played back. -
- NETSTAT (on/off) - - Shows network statistics. -
- TIMELIMIT <integer> - - Sets a time limit for multiplayer levels. (server only) -
- INTTIME <integer> - - Changes the intermission time in multiplayer levels. (server only) -
- AUTOCTF (yes/no) - - Auto-sorts people on teams as they join. (server only) -
- TIMETIC (on/off) - - Displays the time in game tics. -
- SERVERNAME <name> - - Changes the name of the server. -
- INTERNETSERVER (yes/no) - - Enables or disables advertising of the game on the master list. -
- VID_WAIT (on/off) - - Enables/Disables V-Sync. -
- VID_TICRATE (on/off) - - Shows game speed stats on a graph. -
-
-

- - Extras -

-

- knuckles.png (16482 bytes) -

-

- There are many add-ons and extra goodies for SRB2! Visit the Addons - section at www.srb2.org for a large - cache of downloads. -

-

- -

-
-

- - Troubleshooting -

-

- Have a problem? Question? Can't get SRB2 to work? Stop by the Forum at - www.srb2.org and ask. Someone will be - glad to help you work through the problem. -

-

- + + +

- + \ No newline at end of file diff --git a/libs/fmodex/lib/libfmodex64_vc.a b/libs/fmodex/lib/libfmodex64_vc.a deleted file mode 120000 index 20ca620dc..000000000 --- a/libs/fmodex/lib/libfmodex64_vc.a +++ /dev/null @@ -1 +0,0 @@ -fmodex64_vc.lib \ No newline at end of file diff --git a/libs/fmodex/lib/libfmodexL64_vc.a b/libs/fmodex/lib/libfmodexL64_vc.a deleted file mode 120000 index 082105d95..000000000 --- a/libs/fmodex/lib/libfmodexL64_vc.a +++ /dev/null @@ -1 +0,0 @@ -fmodexL64_vc.lib \ No newline at end of file diff --git a/libs/fmodex/lib/libfmodexL_vc.a b/libs/fmodex/lib/libfmodexL_vc.a deleted file mode 120000 index fe8fb4df3..000000000 --- a/libs/fmodex/lib/libfmodexL_vc.a +++ /dev/null @@ -1 +0,0 @@ -fmodexL_vc.lib \ No newline at end of file diff --git a/libs/fmodex/lib/libfmodex_vc.a b/libs/fmodex/lib/libfmodex_vc.a deleted file mode 120000 index 290610c08..000000000 --- a/libs/fmodex/lib/libfmodex_vc.a +++ /dev/null @@ -1 +0,0 @@ -fmodex_vc.lib \ No newline at end of file diff --git a/readme.txt b/readme.txt index d8a040be0..176d29241 100644 --- a/readme.txt +++ b/readme.txt @@ -1,4 +1,4 @@ -Here it is! SRB2 v2.1.8 source code! +Here it is! SRB2 v2.1.9 source code! (why do we keep the version number up to date when everything else in this file is hilariously old? - Inuyasha) diff --git a/src/Makefile b/src/Makefile index a5d5dc191..f5d58af3a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -10,7 +10,7 @@ # -DPC_DOS -> use DOS specific code (eg:textmode stuff)... # -DLINUX -> use for the GNU/Linux specific # -D_WINDOWS -> use for the Win32/DirectX specific -# -DSDL -> use for the SDL interface +# -DHAVE_SDL -> use for the SDL interface # # Sets: # Compile the DGJPP/DOS version with 'make WATTCP=1' @@ -599,6 +599,7 @@ ifndef NOUPX -$(UPX) $(UPX_OPTS) $(BIN)/$(EXENAME) endif endif + @echo Build is done, please look for $(EXENAME) in $(BIN), \(checking for post steps\) reobjdump: @echo Redumping debugging info diff --git a/src/Makefile.cfg b/src/Makefile.cfg index ccf84165f..1ea96df92 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -230,7 +230,6 @@ ifdef DUMMY BIN:=$(BIN)/dummy else ifdef LINUX - INTERFACE=sdl NASMFORMAT=elf -DLINUX SDL=1 ifndef NOGETTEXT diff --git a/src/console.c b/src/console.c index f8d31a698..e77c400b3 100644 --- a/src/console.c +++ b/src/console.c @@ -1139,7 +1139,7 @@ void CONS_Printf(const char *fmt, ...) // if not in display loop, force screen update if (con_startup) { -#if (defined (_WINDOWS)) || (defined (__OS2__) && !defined (SDL)) +#if (defined (_WINDOWS)) || (defined (__OS2__) && !defined (HAVE_SDL)) static lumpnum_t con_backpic_lumpnum = UINT32_MAX; patch_t *con_backpic; @@ -1383,7 +1383,6 @@ static void CON_DrawConsole(void) UINT8 *p; size_t i; INT32 y; - INT32 w = 0, x2 = 0; INT32 charflags = 0; INT32 charwidth = (INT32)con_scalefactor << 3; INT32 charheight = charwidth; @@ -1416,9 +1415,9 @@ static void CON_DrawConsole(void) } else { - x2 = vid.width; - // Hurdler: what's the correct value of w and x2 in hardware mode??? - if (rendermode != render_none) V_DrawFadeConsBack(w, 0, x2, con_curlines, cons_backcolor.value); // translucent background + // inu: no more width (was always 0 and vid.width) + if (rendermode != render_none) + V_DrawFadeConsBack(con_curlines, cons_backcolor.value); // translucent background } // draw console text lines from top to bottom diff --git a/src/d_clisrv.c b/src/d_clisrv.c index dff495b10..b086077d4 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1041,6 +1041,40 @@ static void GetPackets(void); static cl_mode_t cl_mode = cl_searching; +// Player name send/load + +static void CV_SavePlayerNames(UINT8 **p) +{ + INT32 i = 0; + // Players in game only. + for (; i < MAXPLAYERS; ++i) + { + if (!playeringame[i]) + { + WRITEUINT8(*p, 0); + continue; + } + WRITESTRING(*p, player_names[i]); + } +} + +static void CV_LoadPlayerNames(UINT8 **p) +{ + INT32 i = 0; + char tmp_name[MAXPLAYERNAME+1]; + tmp_name[MAXPLAYERNAME] = 0; + + for (; i < MAXPLAYERS; ++i) + { + READSTRING(*p, tmp_name); + if (tmp_name[0] == 0) + continue; + if (tmp_name[MAXPLAYERNAME]) // overflow detected + I_Error("Received bad server config packet when trying to join"); + memcpy(player_names[i], tmp_name, MAXPLAYERNAME+1); + } +} + #ifdef CLIENT_LOADINGSCREEN // // CL_DrawConnectionStatus @@ -1070,6 +1104,7 @@ static inline void CL_DrawConnectionStatus(void) switch (cl_mode) { +#ifdef JOININGAME case cl_downloadsavegame: cltext = M_GetText("Downloading game state..."); Net_GetNetStat(); @@ -1078,6 +1113,7 @@ static inline void CL_DrawConnectionStatus(void) V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE, va("%3.1fK/s ", ((double)getbps)/1024)); break; +#endif case cl_askjoin: case cl_waitjoinresponse: cltext = M_GetText("Requesting to join..."); @@ -1257,27 +1293,38 @@ static boolean SV_SendServerConfig(INT32 node) INT32 i; UINT8 *p, *op; boolean waspacketsent; - UINT32 playermask = 0; netbuffer->packettype = PT_SERVERCFG; - for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i]) - playermask |= 1<u.servercfg.version = VERSION; netbuffer->u.servercfg.subversion = SUBVERSION; netbuffer->u.servercfg.serverplayer = (UINT8)serverplayer; netbuffer->u.servercfg.totalslotnum = (UINT8)(doomcom->numslots); - netbuffer->u.servercfg.playerdetected = LONG(playermask); netbuffer->u.servercfg.gametic = (tic_t)LONG(gametic); netbuffer->u.servercfg.clientnode = (UINT8)node; netbuffer->u.servercfg.gamestate = (UINT8)gamestate; netbuffer->u.servercfg.gametype = (UINT8)gametype; netbuffer->u.servercfg.modifiedgame = (UINT8)modifiedgame; netbuffer->u.servercfg.adminplayer = (SINT8)adminplayer; + + // we fill these structs with FFs so that any players not in game get sent as 0xFFFF + // which is nice and easy for us to detect + memset(netbuffer->u.servercfg.playerskins, 0xFF, sizeof(netbuffer->u.servercfg.playerskins)); + memset(netbuffer->u.servercfg.playercolor, 0xFF, sizeof(netbuffer->u.servercfg.playercolor)); + + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i]) + continue; + netbuffer->u.servercfg.playerskins[i] = (UINT8)players[i].skin; + netbuffer->u.servercfg.playercolor[i] = (UINT8)players[i].skincolor; + } + memcpy(netbuffer->u.servercfg.server_context, server_context, 8); - op = p = netbuffer->u.servercfg.netcvarstates; + op = p = netbuffer->u.servercfg.varlengthinputs; + + CV_SavePlayerNames(&p); CV_SaveNetVars(&p); { const size_t len = sizeof (serverconfig_pak) + (size_t)(p - op); @@ -2063,7 +2110,7 @@ static void Command_connect(void) return; } - if (Playing()) + if (Playing() || titledemo) { CONS_Printf(M_GetText("You cannot connect while in a game. End this game first.\n")); return; @@ -3116,6 +3163,11 @@ static void HandleConnect(SINT8 node) SV_AddWaitingPlayers(); player_joining = true; } +#else +#ifndef NONET + // I guess we have no use for this if we aren't doing mid-level joins? + (void)newnode; +#endif #endif } } @@ -3248,7 +3300,6 @@ FILESTAMP { INT32 j; UINT8 *scp; - UINT32 playermask = 0; if (server && serverrunning && node != servernode) { // but wait I thought I'm the server? @@ -3283,11 +3334,20 @@ FILESTAMP #endif DEBFILE(va("Server accept join gametic=%u mynode=%d\n", gametic, mynode)); - playermask = LONG(netbuffer->u.servercfg.playerdetected); + memset(playeringame, 0, sizeof(playeringame)); for (j = 0; j < MAXPLAYERS; j++) - playeringame[j] = (playermask & (1<u.servercfg.playerskins[j] == 0xFF + && netbuffer->u.servercfg.playercolor[j] == 0xFF) + continue; // not in game - scp = netbuffer->u.servercfg.netcvarstates; + playeringame[j] = true; + SetPlayerSkinByNum(j, (INT32)netbuffer->u.servercfg.playerskins[j]); + players[j].skincolor = netbuffer->u.servercfg.playercolor[j]; + } + + scp = netbuffer->u.servercfg.varlengthinputs; + CV_LoadPlayerNames(&scp); CV_LoadNetVars(&scp); #ifdef JOININGAME if (netbuffer->u.servercfg.gamestate == GS_LEVEL/* || diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 0086132e6..700fb5f67 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -267,14 +267,17 @@ typedef struct UINT8 clientnode; UINT8 gamestate; - UINT32 playerdetected; // playeringame vector in bit field + // 0xFF == not in game; else player skin num + UINT8 playerskins[MAXPLAYERS]; + UINT8 playercolor[MAXPLAYERS]; + UINT8 gametype; UINT8 modifiedgame; SINT8 adminplayer; // needs to be signed char server_context[8]; // unique context id, generated at server startup. - UINT8 netcvarstates[0]; + UINT8 varlengthinputs[0]; // playernames and netvars } ATTRPACK serverconfig_pak; typedef struct { diff --git a/src/d_main.c b/src/d_main.c index 2f3dd8b61..42734fbc9 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -659,6 +659,7 @@ void D_StartTitle(void) // okay, stop now // (otherwise the game still thinks we're playing!) SV_StopServer(); + SV_ResetServer(); // In case someone exits out at the same time they start a time attack run, // reset modeattacking @@ -731,7 +732,7 @@ static void IdentifyVersion(void) char *srb2wad1, *srb2wad2; const char *srb2waddir = NULL; -#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL) +#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) // change to the directory where 'srb2.srb' is found srb2waddir = I_LocateWad(); #endif @@ -757,7 +758,7 @@ static void IdentifyVersion(void) } } -#if defined (macintosh) && !defined (SDL) +#if defined (macintosh) && !defined (HAVE_SDL) // cwd is always "/" when app is dbl-clicked if (!stricmp(srb2waddir, "/")) srb2waddir = I_GetWadDir(); @@ -804,7 +805,7 @@ static void IdentifyVersion(void) // Add our crappy patches to fix our bugs D_AddFile(va(pandf,srb2waddir,"patch.dta")); -#if !defined (SDL) || defined (HAVE_MIXER) +#if !defined (HAVE_SDL) || defined (HAVE_MIXER) { #if defined (DC) && 0 const char *musicfile = "music_dc.dta"; @@ -929,7 +930,7 @@ void D_SRB2Main(void) D_Titlebar(srb2, title); #endif -#if defined (__OS2__) && !defined (SDL) +#if defined (__OS2__) && !defined (HAVE_SDL) // set PM window title snprintf(pmData->title, sizeof (pmData->title), "Sonic Robo Blast 2" VERSIONSTRING ": %s", @@ -1086,14 +1087,14 @@ void D_SRB2Main(void) #endif D_CleanFile(); -#if 1 // md5s last updated 4/13/14 +#if 1 // md5s last updated 8/03/14 // Check MD5s of autoloaded files W_VerifyFileMD5(0, "ac309fb3c7d4b5b685e2cd26beccf0e8"); // srb2.srb/srb2.wad W_VerifyFileMD5(1, "e956466eff2c79f7b1cdefad24761bce"); // zones.dta W_VerifyFileMD5(2, "95a4cdbed287323dd361243f357a5fd2"); // player.dta W_VerifyFileMD5(3, "85901ad4bf94637e5753d2ac2c03ea26"); // rings.dta - W_VerifyFileMD5(4, "1f37fe7bcc608a23eadb0e2c2d7c7124"); // patch.dta + W_VerifyFileMD5(4, "636e4c7b71e770e8368b48fcfe07bbd8"); // patch.dta // don't check music.dta because people like to modify it, and it doesn't matter if they do // ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for. #endif @@ -1136,7 +1137,7 @@ void D_SRB2Main(void) G_LoadGameData(); -#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL) +#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) VID_PrepareModeList(); // Regenerate Modelist according to cv_fullscreen #endif diff --git a/src/d_net.c b/src/d_net.c index 906c53890..d13c4bd25 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -800,9 +800,8 @@ static void DebugPrintpacket(const char *header) fprintfstring((char *)netbuffer->u.textcmd+1, netbuffer->u.textcmd[0]); break; case PT_SERVERCFG: - fprintf(debugfile, " playermask %x playerslots %d clientnode %d serverplayer %d " + fprintf(debugfile, " playerslots %d clientnode %d serverplayer %d " "gametic %u gamestate %d gametype %d modifiedgame %d\n", - (UINT32)LONG(netbuffer->u.servercfg.playerdetected), netbuffer->u.servercfg.totalslotnum, netbuffer->u.servercfg.clientnode, netbuffer->u.servercfg.serverplayer, (UINT32)LONG(netbuffer->u.servercfg.gametic), netbuffer->u.servercfg.gamestate, netbuffer->u.servercfg.gametype, diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 1a1777a4d..dd7435bde 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -106,8 +106,6 @@ static void Command_Stopdemo_f(void); static void Command_StartMovie_f(void); static void Command_StopMovie_f(void); static void Command_Map_f(void); -static void Command_Teleport_f(void); -static void Command_RTeleport_f(void); static void Command_ResetCamera_f(void); static void Command_Addfile(void); @@ -124,13 +122,11 @@ static void Command_Version_f(void); static void Command_ModDetails_f(void); #endif static void Command_ShowGametype_f(void); -static void Command_JumpToAxis_f(void); FUNCNORETURN static ATTRNORETURN void Command_Quit_f(void); static void Command_Playintro_f(void); static void Command_Displayplayer_f(void); static void Command_Tunes_f(void); -static void Command_Skynum_f(void); static void Command_ExitLevel_f(void); static void Command_Showmap_f(void); @@ -258,7 +254,7 @@ consvar_t cv_usejoystick = {"use_joystick", "0", CV_SAVE|CV_CALL, usejoystick_co consvar_t cv_usejoystick2 = {"use_joystick2", "0", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL}; #endif -#if (defined (LJOYSTICK) || defined (SDL)) +#if (defined (LJOYSTICK) || defined (HAVE_SDL)) #ifdef LJOYSTICK consvar_t cv_joyport = {"joyport", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_joyport2 = {"joyport2", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; //Alam: for later @@ -333,7 +329,7 @@ consvar_t cv_overtime = {"overtime", "Yes", CV_NETVAR, CV_YesNo, NULL, 0, NULL, consvar_t cv_rollingdemos = {"rollingdemos", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_timetic = {"timerres", "Normal", 0, timetic_cons_t, NULL, CV_SAVE, NULL, NULL, 0, 0, NULL}; // use tics in display +consvar_t cv_timetic = {"timerres", "Normal", CV_SAVE, timetic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; // use tics in display consvar_t cv_resetmusic = {"resetmusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t pointlimit_cons_t[] = {{0, "MIN"}, {999999990, "MAX"}, {0, NULL}}; @@ -444,7 +440,6 @@ void D_RegisterServerCommands(void) COM_AddCommand("suicide", Command_Suicide); COM_AddCommand("gametype", Command_ShowGametype_f); - COM_AddCommand("jumptoaxis", Command_JumpToAxis_f); COM_AddCommand("version", Command_Version_f); #ifdef UPDATE_ALERT COM_AddCommand("mod_details", Command_ModDetails_f); @@ -766,11 +761,13 @@ void D_RegisterClientCommands(void) COM_AddCommand("scale", Command_Scale_f); COM_AddCommand("gravflip", Command_Gravflip_f); COM_AddCommand("hurtme", Command_Hurtme_f); + COM_AddCommand("jumptoaxis", Command_JumpToAxis_f); COM_AddCommand("charability", Command_Charability_f); COM_AddCommand("charspeed", Command_Charspeed_f); COM_AddCommand("teleport", Command_Teleport_f); COM_AddCommand("rteleport", Command_RTeleport_f); COM_AddCommand("skynum", Command_Skynum_f); + COM_AddCommand("weather", Command_Weather_f); #ifdef _DEBUG COM_AddCommand("causecfail", Command_CauseCfail_f); #endif @@ -1384,149 +1381,6 @@ static void Command_ResetCamera_f(void) P_ResetCamera(&players[displayplayer], &camera); } -static void Command_RTeleport_f(void) -{ - fixed_t intx, inty, intz; - size_t i; - player_t *p = &players[consoleplayer]; - subsector_t *ss; - - if (!(cv_debug || devparm)) - { - CONS_Printf(M_GetText("DEVMODE must be enabled.")); - return; - } - if (netgame) - { - CONS_Printf(M_GetText("This only works in single player.\n")); - return; - } - - if (COM_Argc() < 3 || COM_Argc() > 7) - { - CONS_Printf(M_GetText("rteleport -x -y -z : relative teleport to a location\n")); - return; - } - - if (!p->mo) - return; - - i = COM_CheckParm("-x"); - if (i) - intx = atoi(COM_Argv(i + 1)); - else - intx = 0; - - i = COM_CheckParm("-y"); - if (i) - inty = atoi(COM_Argv(i + 1)); - else - inty = 0; - - ss = R_PointInSubsector(p->mo->x + intx*FRACUNIT, p->mo->y + inty*FRACUNIT); - if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height) - { - CONS_Alert(CONS_NOTICE, M_GetText("Not a valid location.\n")); - return; - } - i = COM_CheckParm("-z"); - if (i) - { - intz = atoi(COM_Argv(i + 1)); - intz <<= FRACBITS; - intz += p->mo->z; - if (intz < ss->sector->floorheight) - intz = ss->sector->floorheight; - if (intz > ss->sector->ceilingheight - p->mo->height) - intz = ss->sector->ceilingheight - p->mo->height; - } - else - intz = 0; - - CONS_Printf(M_GetText("Teleporting by %d, %d, %d...\n"), intx, inty, FixedInt((intz-p->mo->z))); - - P_MapStart(); - if (!P_TeleportMove(p->mo, p->mo->x+intx*FRACUNIT, p->mo->y+inty*FRACUNIT, intz)) - CONS_Alert(CONS_WARNING, M_GetText("Unable to teleport to that spot!\n")); - else - S_StartSound(p->mo, sfx_mixup); - P_MapEnd(); -} - -static void Command_Teleport_f(void) -{ - fixed_t intx, inty, intz; - size_t i; - player_t *p = &players[consoleplayer]; - subsector_t *ss; - - if (!(cv_debug || devparm)) - { - CONS_Printf(M_GetText("DEVMODE must be enabled.")); - return; - } - if (netgame) - { - CONS_Printf(M_GetText("This only works in single player.\n")); - return; - } - - if (COM_Argc() < 3 || COM_Argc() > 7) - { - CONS_Printf(M_GetText("teleport -x -y -z : teleport to a location\n")); - return; - } - - if (!p->mo) - return; - - i = COM_CheckParm("-x"); - if (i) - intx = atoi(COM_Argv(i + 1)); - else - { - CONS_Alert(CONS_NOTICE, M_GetText("%s value not specified\n"), "X"); - return; - } - - i = COM_CheckParm("-y"); - if (i) - inty = atoi(COM_Argv(i + 1)); - else - { - CONS_Alert(CONS_NOTICE, M_GetText("%s value not specified\n"), "Y"); - return; - } - - ss = R_PointInSubsector(intx*FRACUNIT, inty*FRACUNIT); - if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height) - { - CONS_Alert(CONS_NOTICE, M_GetText("Not a valid location.\n")); - return; - } - i = COM_CheckParm("-z"); - if (i) - { - intz = atoi(COM_Argv(i + 1)); - intz <<= FRACBITS; - if (intz < ss->sector->floorheight) - intz = ss->sector->floorheight; - if (intz > ss->sector->ceilingheight - p->mo->height) - intz = ss->sector->ceilingheight - p->mo->height; - } - else - intz = ss->sector->floorheight; - - CONS_Printf(M_GetText("Teleporting to %d, %d, %d...\n"), intx, inty, FixedInt(intz)); - - P_MapStart(); - if (!P_TeleportMove(p->mo, intx*FRACUNIT, inty*FRACUNIT, intz)) - CONS_Alert(CONS_WARNING, M_GetText("Unable to teleport to that spot!\n")); - else - S_StartSound(p->mo, sfx_mixup); - P_MapEnd(); -} - // ======================================================================== // play a demo, add .lmp for external demos @@ -3359,23 +3213,6 @@ static void Command_ShowGametype_f(void) CONS_Printf(M_GetText("Current gametype is %d\n"), gametype); } -// Moves the NiGHTS player to another axis within the current mare -// Only for development purposes. -// -static void Command_JumpToAxis_f(void) -{ - if (!cv_debug) - CONS_Printf(M_GetText("DEVMODE must be enabled.\n")); - - if (COM_Argc() != 2) - { - CONS_Printf(M_GetText("jumptoaxis : Jump to axis within current mare.\n")); - return; - } - - P_TransferToAxis(&players[consoleplayer], atoi(COM_Argv(1))); -} - /** Plays the intro. */ static void Command_Playintro_f(void) @@ -3926,32 +3763,6 @@ static void Command_Displayplayer_f(void) CONS_Printf(M_GetText("Displayplayer is %d\n"), displayplayer); } -static void Command_Skynum_f(void) -{ - if (!cv_debug) - { - CONS_Printf(M_GetText("DEVMODE must be enabled.\n")); - CONS_Printf(M_GetText("If you want to change the sky interactively on a map, use the linedef executor feature instead.\n")); - return; - } - - if (netgame || multiplayer) - { - CONS_Printf(M_GetText("This only works in single player.\n")); - return; - } - - if (COM_Argc() != 2) - { - CONS_Printf(M_GetText("skynum : change the sky\n")); - return; - } - - CONS_Printf(M_GetText("Previewing sky %s...\n"), COM_Argv(1)); - - P_SetupLevelSky(atoi(COM_Argv(1)), false); -} - static void Command_Tunes_f(void) { const char *tunearg; diff --git a/src/d_player.h b/src/d_player.h index 4b2978546..b0484f0a1 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -38,6 +38,7 @@ typedef enum SF_HIRES = 1<<3, // Draw the sprite 2x as small? SF_NOSKID = 1<<4, // No skid particles etc SF_NOSPEEDADJUST = 1<<5, // Skin-specific version of disablespeedadjust + SF_RUNONWATER = 1<<6, // Run on top of water FOFs? } skinflags_t; //Primary and secondary skin abilities @@ -55,7 +56,8 @@ typedef enum CA_TELEKINESIS, CA_FALLSWITCH, CA_JUMPBOOST, - CA_AIRDRILL + CA_AIRDRILL, + CA_JUMPTHOK } charability_t; //Secondary skin abilities @@ -147,7 +149,10 @@ typedef enum PF_TAGGED = 1<<27, // Player has been tagged and awaits the next round in hide and seek. PF_TAGIT = 1<<28, // The player is it! For Tag Mode - // free: 1<<29 through 1<<31 + /*** misc ***/ + PF_FORCESTRAFE = 1<<29, // Turning inputs are translated into strafing inputs + + // free: 1<<30 and 1<<31 } pflags_t; typedef enum diff --git a/src/dehacked.c b/src/dehacked.c index 9c2fe4d22..5149fddd5 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -27,6 +27,7 @@ #include "p_local.h" // for var1 and var2, and some constants #include "p_setup.h" #include "r_data.h" +#include "r_sky.h" #include "fastcmp.h" #include "lua_script.h" #include "lua_hook.h" @@ -364,6 +365,10 @@ static void clear_levels(void) if (!mapheaderinfo[i]) continue; + // Custom map header info + // (no need to set num to 0, we're freeing the entire header shortly) + Z_Free(mapheaderinfo[i]->customopts); + P_DeleteGrades(i); Z_Free(mapheaderinfo[i]); mapheaderinfo[i] = NULL; @@ -991,6 +996,7 @@ static void readlevelheader(MYFILE *f, INT32 num) char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); char *word = s; char *word2; + //char *word3; // Non-uppercase version of word2 char *tmp; INT32 i; @@ -1034,6 +1040,49 @@ static void readlevelheader(MYFILE *f, INT32 num) continue; } + // Lua custom options also go above, contents may be case sensitive. + if (fastncmp(word, "LUA.", 4)) + { +#ifdef HAVE_BLUA + UINT8 j; + customoption_t *modoption; + + // Note: we actualy strlwr word here, so things are made a little easier for Lua + strlwr(word); + word += 4; // move past "lua." + + // ... and do a simple name sanity check; the name must start with a letter + if (*word < 'a' || *word > 'z') + { + deh_warning("Level header %d: invalid custom option name \"%s\"", num, word); + continue; + } + + // Sanity limit of 128 params + if (mapheaderinfo[num-1]->numCustomOptions == 128) + { + deh_warning("Level header %d: too many custom parameters", num); + continue; + } + j = mapheaderinfo[num-1]->numCustomOptions++; + + mapheaderinfo[num-1]->customopts = + Z_Realloc(mapheaderinfo[num-1]->customopts, + sizeof(customoption_t) * mapheaderinfo[num-1]->numCustomOptions, PU_STATIC, NULL); + + // Newly allocated + modoption = &mapheaderinfo[num-1]->customopts[j]; + + strncpy(modoption->option, word, 31); + modoption->option[31] = '\0'; + strncpy(modoption->value, word2, 255); + modoption->value[255] = '\0'; +#else + // Silently ignore. +#endif + continue; + } + // Now go to uppercase strupr(word2); @@ -1047,19 +1096,26 @@ static void readlevelheader(MYFILE *f, INT32 num) deh_warning("Level header %d: unknown word '%s'", num, word); continue; } + P_AddGradesForMare((INT16)(num-1), mare-1, word2); } // Strings that can be truncated else if (fastcmp(word, "LEVELNAME")) + { deh_strlcpy(mapheaderinfo[num-1]->lvlttl, word2, sizeof(mapheaderinfo[num-1]->lvlttl), va("Level header %d: levelname", num)); + } else if (fastcmp(word, "SCRIPTNAME")) + { deh_strlcpy(mapheaderinfo[num-1]->scriptname, word2, sizeof(mapheaderinfo[num-1]->scriptname), va("Level header %d: scriptname", num)); + } else if (fastcmp(word, "RUNSOC")) + { deh_strlcpy(mapheaderinfo[num-1]->runsoc, word2, sizeof(mapheaderinfo[num-1]->runsoc), va("Level header %d: runsoc", num)); + } else if (fastcmp(word, "ACT")) { if (i >= 0 && i < 20) // 0 for no act number, TTL1 through TTL19 @@ -1240,7 +1296,6 @@ static void readlevelheader(MYFILE *f, INT32 num) else mapheaderinfo[num-1]->menuflags &= ~LF2_NOVISITNEEDED; } - else deh_warning("Level header %d: unknown word '%s'", num, word); } @@ -7145,23 +7200,11 @@ static const char *const MOBJEFLAG_LIST[] = { NULL }; -static const char *const MAPTHINGFLAG_LIST[16] = { +static const char *const MAPTHINGFLAG_LIST[4] = { NULL, "OBJECTFLIP", // Reverse gravity flag for objects. "OBJECTSPECIAL", // Special flag used with certain objects. - "AMBUSH", // Deaf monsters/do not react to sound. - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL + "AMBUSH" // Deaf monsters/do not react to sound. }; static const char *const PLAYERFLAG_LIST[] = { @@ -7228,6 +7271,9 @@ static const char *const PLAYERFLAG_LIST[] = { "TAGGED", // Player has been tagged and awaits the next round in hide and seek. "TAGIT", // The player is it! For Tag Mode + /*** misc ***/ + "FORCESTRAFE", // Translate turn inputs into strafe inputs + NULL // stop loop here. }; @@ -7443,6 +7489,19 @@ struct { {"TOL_ERZ3",TOL_ERZ3}, {"TOL_XMAS",TOL_XMAS}, + // Level flags + {"LF_SCRIPTISFILE",LF_SCRIPTISFILE}, + {"LF_SPEEDMUSIC",LF_SPEEDMUSIC}, + {"LF_NOSSMUSIC",LF_NOSSMUSIC}, + {"LF_NORELOAD",LF_NORELOAD}, + {"LF_NOZONE",LF_NOZONE}, + // And map flags + {"LF2_HIDEINMENU",LF2_HIDEINMENU}, + {"LF2_HIDEINSTATS",LF2_HIDEINSTATS}, + {"LF2_RECORDATTACK",LF2_RECORDATTACK}, + {"LF2_NIGHTSATTACK",LF2_NIGHTSATTACK}, + {"LF2_NOVISITNEEDED",LF2_NOVISITNEEDED}, + // NiGHTS grades {"GRADE_F",GRADE_F}, {"GRADE_E",GRADE_E}, @@ -7507,6 +7566,7 @@ struct { {"SF_HIRES",SF_HIRES}, {"SF_NOSKID",SF_NOSKID}, {"SF_NOSPEEDADJUST",SF_NOSPEEDADJUST}, + {"SF_RUNONWATER",SF_RUNONWATER}, // Character abilities! // Primary @@ -7523,6 +7583,7 @@ struct { {"CA_FALLSWITCH",CA_FALLSWITCH}, {"CA_JUMPBOOST",CA_JUMPBOOST}, {"CA_AIRDRILL",CA_AIRDRILL}, + {"CA_JUMPTHOK",CA_JUMPTHOK}, // Secondary {"CA2_NONE",CA2_NONE}, // now slot 0! {"CA2_SPINDASH",CA2_SPINDASH}, @@ -7590,6 +7651,68 @@ struct { {"GF_REDFLAG",GF_REDFLAG}, {"GF_BLUEFLAG",GF_BLUEFLAG}, + // Customisable sounds for Skins, from sounds.h + {"SKSSPIN",SKSSPIN}, + {"SKSPUTPUT",SKSPUTPUT}, + {"SKSPUDPUD",SKSPUDPUD}, + {"SKSPLPAN1",SKSPLPAN1}, // Ouchies + {"SKSPLPAN2",SKSPLPAN2}, + {"SKSPLPAN3",SKSPLPAN3}, + {"SKSPLPAN4",SKSPLPAN4}, + {"SKSPLDET1",SKSPLDET1}, // Deaths + {"SKSPLDET2",SKSPLDET2}, + {"SKSPLDET3",SKSPLDET3}, + {"SKSPLDET4",SKSPLDET4}, + {"SKSPLVCT1",SKSPLVCT1}, // Victories + {"SKSPLVCT2",SKSPLVCT2}, + {"SKSPLVCT3",SKSPLVCT3}, + {"SKSPLVCT4",SKSPLVCT4}, + {"SKSTHOK",SKSTHOK}, + {"SKSSPNDSH",SKSSPNDSH}, + {"SKSZOOM",SKSZOOM}, + {"SKSSKID",SKSSKID}, + {"SKSGASP",SKSGASP}, + {"SKSJUMP",SKSJUMP}, + + // 3D Floor/Fake Floor/FOF/whatever flags + {"FF_EXISTS",FF_EXISTS}, ///< Always set, to check for validity. + {"FF_BLOCKPLAYER",FF_BLOCKPLAYER}, ///< Solid to player, but nothing else + {"FF_BLOCKOTHERS",FF_BLOCKOTHERS}, ///< Solid to everything but player + {"FF_SOLID",FF_SOLID}, ///< Clips things. + {"FF_RENDERSIDES",FF_RENDERSIDES}, ///< Renders the sides. + {"FF_RENDERPLANES",FF_RENDERPLANES}, ///< Renders the floor/ceiling. + {"FF_RENDERALL",FF_RENDERALL}, ///< Renders everything. + {"FF_SWIMMABLE",FF_SWIMMABLE}, ///< Is a water block. + {"FF_NOSHADE",FF_NOSHADE}, ///< Messes with the lighting? + {"FF_CUTSOLIDS",FF_CUTSOLIDS}, ///< Cuts out hidden solid pixels. + {"FF_CUTEXTRA",FF_CUTEXTRA}, ///< Cuts out hidden translucent pixels. + {"FF_CUTLEVEL",FF_CUTLEVEL}, ///< Cuts out all hidden pixels. + {"FF_CUTSPRITES",FF_CUTSPRITES}, ///< Final step in making 3D water. + {"FF_BOTHPLANES",FF_BOTHPLANES}, ///< Renders both planes all the time. + {"FF_EXTRA",FF_EXTRA}, ///< Gets cut by ::FF_CUTEXTRA. + {"FF_TRANSLUCENT",FF_TRANSLUCENT}, ///< See through! + {"FF_FOG",FF_FOG}, ///< Fog "brush." + {"FF_INVERTPLANES",FF_INVERTPLANES}, ///< Reverse the plane visibility rules. + {"FF_ALLSIDES",FF_ALLSIDES}, ///< Render inside and outside sides. + {"FF_INVERTSIDES",FF_INVERTSIDES}, ///< Only render inside sides. + {"FF_DOUBLESHADOW",FF_DOUBLESHADOW}, ///< Make two lightlist entries to reset light? + {"FF_FLOATBOB",FF_FLOATBOB}, ///< Floats on water and bobs if you step on it. + {"FF_NORETURN",FF_NORETURN}, ///< Used with ::FF_CRUMBLE. Will not return to its original position after falling. + {"FF_CRUMBLE",FF_CRUMBLE}, ///< 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",FF_SHATTERBOTTOM}, ///< Used with ::FF_BUSTUP. Like FF_SHATTER, but only breaks from the bottom. Good for springing up through rubble. + {"FF_MARIO",FF_MARIO}, ///< Acts like a question block when hit from underneath. Goodie spawned at top is determined by master sector. + {"FF_BUSTUP",FF_BUSTUP}, ///< You can spin through/punch this block and it will crumble! + {"FF_QUICKSAND",FF_QUICKSAND}, ///< Quicksand! + {"FF_PLATFORM",FF_PLATFORM}, ///< You can jump up through this to the top. + {"FF_REVERSEPLATFORM",FF_REVERSEPLATFORM}, ///< A fall-through floor in normal gravity, a platform in reverse gravity. + {"FF_INTANGABLEFLATS",FF_INTANGABLEFLATS}, ///< Both flats are intangable, but the sides are still solid. + {"FF_SHATTER",FF_SHATTER}, ///< Used with ::FF_BUSTUP. Thinks everyone's Knuckles. + {"FF_SPINBUST",FF_SPINBUST}, ///< Used with ::FF_BUSTUP. Jump or fall onto it while curled in a ball. + {"FF_ONLYKNUX",FF_ONLYKNUX}, ///< Used with ::FF_BUSTUP. Only Knuckles can break this rock. + {"FF_RIPPLE",FF_RIPPLE}, ///< Ripple the flats + {"FF_COLORMAPONLY",FF_COLORMAPONLY}, ///< Only copy the colormap, not the lightlevel + {"FF_GOOWATER",FF_GOOWATER}, ///< Used with ::FF_SWIMMABLE. Makes thick bouncey goop. + // Angles {"ANG1",ANG1}, {"ANG2",ANG2}, @@ -8266,7 +8389,7 @@ static inline int lib_getenum(lua_State *L) } else if (fastncmp("MTF_", word, 4)) { p = word+4; - for (i = 0; i < 16; i++) + for (i = 0; i < 4; i++) if (MAPTHINGFLAG_LIST[i] && fastcmp(p, MAPTHINGFLAG_LIST[i])) { lua_pushinteger(L, ((lua_Integer)1<mo && (player->mo->flags2 & MF2_TWOD)) || player->climbing || (player->pflags & PF_NIGHTSMODE) - || (player->pflags & PF_SLIDING)) // Analog + || (player->pflags & PF_SLIDING) + || (player->pflags & PF_FORCESTRAFE)) // Analog forcestrafe = true; if (forcestrafe) // Analog { @@ -1243,7 +1244,8 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) || (player->mo && (player->mo->flags2 & MF2_TWOD)) || player->climbing || (player->pflags & PF_NIGHTSMODE) - || (player->pflags & PF_SLIDING)) // Analog + || (player->pflags & PF_SLIDING) + || (player->pflags & PF_FORCESTRAFE)) // Analog forcestrafe = true; if (forcestrafe) // Analog { @@ -2421,6 +2423,8 @@ void G_DoReborn(INT32 playernum) { INT32 i; + player->playerstate = PST_REBORN; + P_LoadThingsOnly(); P_ClearStarPost(player->starpostnum); @@ -2451,6 +2455,12 @@ void G_DoReborn(INT32 playernum) // Starpost support G_SpawnPlayer(playernum, starpost); + + if (botingame) + { // Bots respawn next to their master. + players[secondarydisplayplayer].playerstate = PST_REBORN; + G_SpawnPlayer(secondarydisplayplayer, false); + } } else #ifdef HAVE_BLUA @@ -5175,19 +5185,26 @@ void G_AddGhost(char *defdemoname) I_Assert(mthing); { // A bit more complex than P_SpawnPlayer because ghosts aren't solid and won't just push themselves out of the ceiling. fixed_t x,y,z; + sector_t *sector; x = mthing->x << FRACBITS; y = mthing->y << FRACBITS; - if (mthing->options & MTF_AMBUSH) - z = R_PointInSubsector(x, y)->sector->ceilingheight - mobjinfo[MT_PLAYER].height; - else if (mthing->options >> ZSHIFT) + sector = R_PointInSubsector(x, y)->sector; + if (!!(mthing->options & MTF_AMBUSH) ^ !!(mthing->options & MTF_OBJECTFLIP)) { - sector_t *sector = R_PointInSubsector(x, y)->sector; - z = sector->floorheight + ((mthing->options >> ZSHIFT) << FRACBITS); + z = sector->ceilingheight - mobjinfo[MT_PLAYER].height; + if (mthing->options >> ZSHIFT) + z -= ((mthing->options >> ZSHIFT) << FRACBITS); + if (z < sector->floorheight) + z = sector->floorheight; + } + else + { + z = sector->floorheight; + if (mthing->options >> ZSHIFT) + z += ((mthing->options >> ZSHIFT) << FRACBITS); if (z > sector->ceilingheight - mobjinfo[MT_PLAYER].height) z = sector->ceilingheight - mobjinfo[MT_PLAYER].height; } - else - z = mthing->z << FRACBITS; gh->mo = P_SpawnMobj(x, y, z, MT_GHOST); gh->mo->angle = FixedAngle(mthing->angle*FRACUNIT); } diff --git a/src/hardware/hw3dsdrv.h b/src/hardware/hw3dsdrv.h index 4938f8763..8811d4546 100644 --- a/src/hardware/hw3dsdrv.h +++ b/src/hardware/hw3dsdrv.h @@ -24,7 +24,7 @@ #include "hw_dll.h" #include "hws_data.h" -#if defined (SDL) || !defined (HWD) +#if defined (HAVE_SDL) || !defined (HWD) EXPORT void HWRAPI(Shutdown) (void); #endif diff --git a/src/hardware/hw_data.h b/src/hardware/hw_data.h index 77db10805..a6525a2f5 100644 --- a/src/hardware/hw_data.h +++ b/src/hardware/hw_data.h @@ -26,7 +26,7 @@ #include #endif -#if defined (VID_X11) && !defined (SDL) +#if defined (VID_X11) && !defined (HAVE_SDL) #include #endif diff --git a/src/hardware/hw_drv.h b/src/hardware/hw_drv.h index 854e7aaaf..76fce5e47 100644 --- a/src/hardware/hw_drv.h +++ b/src/hardware/hw_drv.h @@ -32,12 +32,12 @@ // STANDARD DLL EXPORTS // ========================================================================== -#ifdef SDL +#ifdef HAVE_SDL #undef VID_X11 #endif EXPORT boolean HWRAPI(Init) (I_Error_t ErrorFunction); -#ifndef SDL +#ifndef HAVE_SDL EXPORT void HWRAPI(Shutdown) (void); #endif #ifdef _WINDOWS @@ -116,7 +116,7 @@ struct hwdriver_s HookXwin pfnHookXwin; GetRenderer pfnGetRenderer; #endif -#ifndef SDL +#ifndef HAVE_SDL Shutdown pfnShutdown; #endif #ifdef SHUFFLE diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 4f5acca86..9cc4f5625 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -116,10 +116,6 @@ consvar_t cv_granisotropicmode = {"gr_anisotropicmode", "1", CV_CALL, granisotro consvar_t cv_grcorrecttricks = {"gr_correcttricks", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grsolvetjoin = {"gr_solvetjoin", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t CV_MD2[] = {{0, "Off"}, {1, "On"}, {2, "Old"}, {0, NULL}}; -// console variables in development -consvar_t cv_grmd2 = {"gr_md2", "Off", 0, CV_MD2, NULL, 0, NULL, NULL, 0, 0, NULL}; - static void CV_FogDensity_ONChange(void) { HWD.pfnSetSpecialState(HWD_SET_FOG_DENSITY, cv_grfogdensity.value); @@ -4966,7 +4962,6 @@ static void Command_GrStats_f(void) //added by Hurdler: console varibale that are saved void HWR_AddCommands(void) { - CV_RegisterVar(&cv_grmd2); CV_RegisterVar(&cv_grrounddown); CV_RegisterVar(&cv_grfov); CV_RegisterVar(&cv_grfogdensity); diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 2e57ae6e3..b853f084e 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -163,7 +163,7 @@ static I_Error_t I_Error_GL = NULL; // : else do nothing // Returns : // -----------------+ -#if !(defined (SDL) && defined (STATIC3DS)) +#if !(defined (HAVE_SDL) && defined (STATIC3DS)) FUNCPRINTF void DBG_Printf(const char *lpFmt, ...) { #ifdef DEBUG_TO_FILE diff --git a/src/hardware/r_opengl/r_opengl.h b/src/hardware/r_opengl/r_opengl.h index 875ac6fba..fd018f4b1 100644 --- a/src/hardware/r_opengl/r_opengl.h +++ b/src/hardware/r_opengl/r_opengl.h @@ -20,7 +20,7 @@ #ifndef _R_OPENGL_H_ #define _R_OPENGL_H_ -#ifdef SDL +#ifdef HAVE_SDL #ifdef _MSC_VER #pragma warning(disable : 4214 4244) @@ -50,7 +50,7 @@ #undef DEBUG_TO_FILE // maybe defined in previous *.h #define DEBUG_TO_FILE // output debugging msgs to ogllog.txt -#if defined ( SDL ) && !defined ( LOGMESSAGES ) +#if defined ( HAVE_SDL ) && !defined ( LOGMESSAGES ) #undef DEBUG_TO_FILE #endif @@ -109,7 +109,7 @@ extern PFNglGetString pglGetString; extern const GLubyte *gl_extensions; extern RGBA_t myPaletteData[]; -#ifndef SDL +#ifndef HAVE_SDL extern FILE *logstream; #endif extern GLint screen_width; diff --git a/src/hardware/s_ds3d/s_ds3d.c b/src/hardware/s_ds3d/s_ds3d.c index 2cbf95599..5299c1795 100644 --- a/src/hardware/s_ds3d/s_ds3d.c +++ b/src/hardware/s_ds3d/s_ds3d.c @@ -48,7 +48,7 @@ #undef DEBUG_TO_FILE #define DEBUG_TO_FILE -#if defined ( SDL ) && !defined ( LOGMESSAGES ) +#if defined ( HAVE_SDL ) && !defined ( LOGMESSAGES ) #undef DEBUG_TO_FILE #endif diff --git a/src/hardware/s_fmod/s_fmod.c b/src/hardware/s_fmod/s_fmod.c index 849fd44fa..120d63540 100644 --- a/src/hardware/s_fmod/s_fmod.c +++ b/src/hardware/s_fmod/s_fmod.c @@ -55,7 +55,7 @@ FILE *logstream = NULL; #define MAXCHANNEL 1024 #undef DEBUG_TO_FILE -#if defined ( SDL ) && !defined ( LOGMESSAGES ) +#if defined ( HAVE_SDL ) && !defined ( LOGMESSAGES ) #define DEBUG_TO_FILE #endif @@ -1187,7 +1187,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, // handle to DLL module } return TRUE; // Successful DLL_PROCESS_ATTACH. } -#elif !defined (SDL) +#elif !defined (HAVE_SDL) // ************************************************************************** // FUNCTIONS diff --git a/src/hardware/s_openal/s_openal.c b/src/hardware/s_openal/s_openal.c index ad842bde3..7f91ccf2c 100644 --- a/src/hardware/s_openal/s_openal.c +++ b/src/hardware/s_openal/s_openal.c @@ -31,7 +31,7 @@ FILE* logstream = NULL; #include #include #include -#ifndef SDL // let not make a logstream here is we are inline the HW3D in the SDL binary +#ifndef HAVE_SDL // let not make a logstream here is we are inline the HW3D in the SDL binary FILE* logstream = NULL; #endif #endif @@ -49,7 +49,7 @@ FILE* logstream = NULL; #include "../hw3dsdrv.h" //#undef DEBUG_TO_FILE -//#if defined ( SDL ) && !defined ( LOGMESSAGES ) +//#if defined ( HAVE_SDL ) && !defined ( LOGMESSAGES ) #define DEBUG_TO_FILE //#endif diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 96902c732..a6c6dbe0a 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -48,6 +48,7 @@ #ifdef HAVE_BLUA #include "lua_hud.h" +#include "lua_hook.h" #endif // coords are scaled @@ -514,6 +515,11 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) } } +#ifdef HAVE_BLUA + if (LUAh_PlayerMsg(playernum, target, flags, msg)) + return; +#endif + // If it's a CSAY, just CECHO and be done with it. if (flags & HU_CSAY) { diff --git a/src/info.c b/src/info.c index 01c258e44..a964ae80e 100644 --- a/src/info.c +++ b/src/info.c @@ -829,7 +829,7 @@ state_t states[NUMSTATES] = {SPR_NULL, 0, 0, {A_Repeat}, 5*TICRATE, S_CYBRAKDEMONELECTRICBARRIER_SPARK_RANDOMCHECK, S_CYBRAKDEMONELECTRICBARRIER_REVIVE1}, // S_CYBRAKDEMONELECTRICBARRIER_SPARK_RANDOMLOOP, {SPR_NULL, 0, 0, {A_CapeChase}, 0, 0, S_CYBRAKDEMONELECTRICBARRIER_REVIVE2}, // S_CYBRAKDEMONELECTRICBARRIER_REVIVE1 {SPR_NULL, 0, 0, {A_SpawnFreshCopy}, 0, 0, S_CYBRAKDEMONELECTRICBARRIER_REVIVE3}, // S_CYBRAKDEMONELECTRICBARRIER_REVIVE2 - {SPR_NULL, 0, TICRATE, {A_PlaySound}, sfx_s3k79, 0, S_NULL}, // S_CYBRAKDEMONELECTRICBARRIER_INIT1 + {SPR_NULL, 0, TICRATE, {A_PlaySound}, sfx_s3k79, 0, S_NULL}, // S_CYBRAKDEMONELECTRICBARRIER_REVIVE3 {SPR_TARG, 0 + FF_FULLBRIGHT, 1, {A_VileFire}, sfx_s3k9d, MT_CYBRAKDEMON_TARGET_DOT, S_CYBRAKDEMONTARGETRETICULE2}, // S_CYBRAKDEMONTARGETRETICULE1 {SPR_TARG, 6 + FF_FULLBRIGHT, 1, {A_VileFire}, 0, MT_CYBRAKDEMON_TARGET_DOT, S_CYBRAKDEMONTARGETRETICULE3}, // S_CYBRAKDEMONTARGETRETICULE2 diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 6225910a9..d84d3b3a6 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -85,6 +85,13 @@ static int lib_print(lua_State *L) return 0; } +static int lib_evalMath(lua_State *L) +{ + const char *word = luaL_checkstring(L, 1); + lua_pushinteger(L, LUA_EvalMath(word)); + return 1; +} + // M_RANDOM ////////////// @@ -461,6 +468,19 @@ static int lib_pSetScale(lua_State *L) return 0; } +static int lib_pInsideANonSolidFFloor(lua_State *L) +{ + mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); + ffloor_t *rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR)); + //HUDSAFE + if (!mobj) + return LUA_ErrInvalid(L, "mobj_t"); + if (!rover) + return LUA_ErrInvalid(L, "ffloor_t"); + lua_pushboolean(L, P_InsideANonSolidFFloor(mobj, rover)); + return 1; +} + static int lib_pCheckDeathPitCollide(lua_State *L) { mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); @@ -471,6 +491,32 @@ static int lib_pCheckDeathPitCollide(lua_State *L) return 1; } +static int lib_pCheckSolidLava(lua_State *L) +{ + mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); + ffloor_t *rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR)); + //HUDSAFE + if (!mo) + return LUA_ErrInvalid(L, "mobj_t"); + if (!rover) + return LUA_ErrInvalid(L, "ffloor_t"); + lua_pushboolean(L, P_CheckSolidLava(mo, rover)); + return 1; +} + +static int lib_pCanRunOnWater(lua_State *L) +{ + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + ffloor_t *rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR)); + //HUDSAFE + if (!player) + return LUA_ErrInvalid(L, "player_t"); + if (!rover) + return LUA_ErrInvalid(L, "ffloor_t"); + lua_pushboolean(L, P_CanRunOnWater(player, rover)); + return 1; +} + // P_USER //////////// @@ -532,9 +578,9 @@ static int lib_pDoPlayerPain(lua_State *L) NOHUD if (!player) return LUA_ErrInvalid(L, "player_t"); - if (!lua_isnone(L, 2) && lua_touserdata(L, 2)) + if (!lua_isnone(L, 2) && lua_isuserdata(L, 2)) source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); - if (!lua_isnone(L, 3) && lua_touserdata(L, 3)) + if (!lua_isnone(L, 3) && lua_isuserdata(L, 3)) inflictor = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)); P_DoPlayerPain(player, source, inflictor); return 0; @@ -550,6 +596,16 @@ static int lib_pResetPlayer(lua_State *L) return 0; } +static int lib_pIsObjectInGoop(lua_State *L) +{ + mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); + //HUDSAFE + if (!mo) + return LUA_ErrInvalid(L, "mobj_t"); + lua_pushboolean(L, P_IsObjectInGoop(mo)); + return 1; +} + static int lib_pIsObjectOnGround(lua_State *L) { mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); @@ -560,6 +616,26 @@ static int lib_pIsObjectOnGround(lua_State *L) return 1; } +static int lib_pInSpaceSector(lua_State *L) +{ + mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); + //HUDSAFE + if (!mo) + return LUA_ErrInvalid(L, "mobj_t"); + lua_pushboolean(L, P_InSpaceSector(mo)); + return 1; +} + +static int lib_pInQuicksand(lua_State *L) +{ + mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); + //HUDSAFE + if (!mo) + return LUA_ErrInvalid(L, "mobj_t"); + lua_pushboolean(L, P_InQuicksand(mo)); + return 1; +} + static int lib_pSetObjectMomZ(lua_State *L) { mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); @@ -582,6 +658,16 @@ static int lib_pRestoreMusic(lua_State *L) return 0; } +static int lib_pSpawnShieldOrb(lua_State *L) +{ + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + NOHUD + if (!player) + return LUA_ErrInvalid(L, "player_t"); + P_SpawnShieldOrb(player); + return 0; +} + static int lib_pSpawnGhostMobj(lua_State *L) { mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); @@ -624,6 +710,16 @@ static int lib_pResetScore(lua_State *L) return 0; } +static int lib_pDoJumpShield(lua_State *L) +{ + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + NOHUD + if (!player) + return LUA_ErrInvalid(L, "player_t"); + P_DoJumpShield(player); + return 0; +} + static int lib_pBlackOw(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); @@ -746,6 +842,41 @@ static int lib_pDoJump(lua_State *L) return 0; } +static int lib_pSpawnThokMobj(lua_State *L) +{ + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + NOHUD + if (!player) + return LUA_ErrInvalid(L, "player_t"); + P_SpawnThokMobj(player); + return 0; +} + +static int lib_pSpawnSpinMobj(lua_State *L) +{ + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + mobjtype_t type = luaL_checkinteger(L, 2); + NOHUD + if (!player) + return LUA_ErrInvalid(L, "player_t"); + if (type > MT_LASTFREESLOT) + return luaL_error(L, "mobjtype_t out of bounds error!"); + P_SpawnSpinMobj(player, type); + return 0; +} + +static int lib_pTelekinesis(lua_State *L) +{ + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + fixed_t thrust = (fixed_t)luaL_checkinteger(L, 2); + fixed_t range = (fixed_t)luaL_checkinteger(L, 3); + NOHUD + if (!player) + return LUA_ErrInvalid(L, "player_t"); + P_Telekinesis(player, thrust, range); + return 0; +} + // P_MAP /////////// @@ -877,6 +1008,18 @@ static int lib_pFloorzAtPos(lua_State *L) lua_pushinteger(L, P_FloorzAtPos(x, y, z, height)); return 1; } + +static int lib_pDoSpring(lua_State *L) +{ + mobj_t *spring = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); + mobj_t *object = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); + NOHUD + if (!spring || !object) + return LUA_ErrInvalid(L, "mobj_t"); + P_DoSpring(spring, object); + return 0; +} + // P_INTER //////////// @@ -897,9 +1040,9 @@ static int lib_pDamageMobj(lua_State *L) NOHUD if (!target) return LUA_ErrInvalid(L, "mobj_t"); - if (!lua_isnone(L, 2) && lua_touserdata(L, 2)) + if (!lua_isnone(L, 2) && lua_isuserdata(L, 2)) inflictor = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); - if (!lua_isnone(L, 3) && lua_touserdata(L, 3)) + if (!lua_isnone(L, 3) && lua_isuserdata(L, 3)) source = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)); damage = (INT32)luaL_optinteger(L, 4, 1); lua_pushboolean(L, P_DamageMobj(target, inflictor, source, damage)); @@ -912,9 +1055,9 @@ static int lib_pKillMobj(lua_State *L) NOHUD if (!target) return LUA_ErrInvalid(L, "mobj_t"); - if (!lua_isnone(L, 2) && lua_touserdata(L, 2)) + if (!lua_isnone(L, 2) && lua_isuserdata(L, 2)) inflictor = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); - if (!lua_isnone(L, 3) && lua_touserdata(L, 3)) + if (!lua_isnone(L, 3) && lua_isuserdata(L, 3)) source = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)); P_KillMobj(target, inflictor, source); return 0; @@ -978,30 +1121,54 @@ static int lib_pPlayerFlagBurst(lua_State *L) static int lib_pPlayRinglossSound(lua_State *L) { mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); + player_t *player = NULL; NOHUD if (!source) return LUA_ErrInvalid(L, "mobj_t"); - P_PlayRinglossSound(source); + if (!lua_isnone(L, 2) && lua_isuserdata(L, 2)) + { + player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER)); + if (!player) + return LUA_ErrInvalid(L, "player_t"); + } + if (!player || P_IsLocalPlayer(player)) + P_PlayRinglossSound(source); return 0; } static int lib_pPlayDeathSound(lua_State *L) { mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); + player_t *player = NULL; NOHUD if (!source) return LUA_ErrInvalid(L, "mobj_t"); - P_PlayDeathSound(source); + if (!lua_isnone(L, 2) && lua_isuserdata(L, 2)) + { + player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER)); + if (!player) + return LUA_ErrInvalid(L, "player_t"); + } + if (!player || P_IsLocalPlayer(player)) + P_PlayDeathSound(source); return 0; } static int lib_pPlayVictorySound(lua_State *L) { mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); + player_t *player = NULL; NOHUD if (!source) return LUA_ErrInvalid(L, "mobj_t"); - P_PlayVictorySound(source); + if (!lua_isnone(L, 2) && lua_isuserdata(L, 2)) + { + player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER)); + if (!player) + return LUA_ErrInvalid(L, "player_t"); + } + if (!player || P_IsLocalPlayer(player)) + P_PlayVictorySound(source); return 0; } @@ -1110,8 +1277,14 @@ static int lib_pFindSpecialLineFromTag(lua_State *L) static int lib_pSwitchWeather(lua_State *L) { INT32 weathernum = (INT32)luaL_checkinteger(L, 1); + player_t *user = NULL; NOHUD - P_SwitchWeather(weathernum); + if (!lua_isnone(L, 2) && lua_isuserdata(L, 2)) // if a player, setup weather for only the player, otherwise setup weather for all players + user = *((player_t **)luaL_checkudata(L, 2, META_PLAYER)); + if (!user) // global + globalweather = weathernum; + if (!user || P_IsLocalPlayer(user)) + P_SwitchWeather(weathernum); return 0; } @@ -1159,12 +1332,27 @@ static int lib_pThingOnSpecial3DFloor(lua_State *L) return 1; } +static int lib_pIsFlagAtBase(lua_State *L) +{ + mobjtype_t flag = luaL_checkinteger(L, 1); + NOHUD + if (flag > MT_LASTFREESLOT) + return luaL_error(L, "mobjtype_t out of bounds error!"); + lua_pushboolean(L, P_IsFlagAtBase(flag)); + return 1; +} + static int lib_pSetupLevelSky(lua_State *L) { INT32 skynum = (INT32)luaL_checkinteger(L, 1); - boolean global = lua_optboolean(L, 2); + player_t *user = NULL; NOHUD - P_SetupLevelSky(skynum, global); + if (!lua_isnone(L, 2) && lua_isuserdata(L, 2)) // if a player, setup sky for only the player, otherwise setup sky for all players + user = *((player_t **)luaL_checkudata(L, 2, META_PLAYER)); + if (!user) // global + P_SetupLevelSky(skynum, true); + else if (P_IsLocalPlayer(user)) + P_SetupLevelSky(skynum, false); return 0; } @@ -1279,6 +1467,19 @@ static int lib_pStartQuake(lua_State *L) return 0; } +static int lib_evCrumbleChain(lua_State *L) +{ + sector_t *sec = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); + ffloor_t *rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR)); + NOHUD + if (!sec) + return LUA_ErrInvalid(L, "sector_t"); + if (!rover) + return LUA_ErrInvalid(L, "ffloor_t"); + EV_CrumbleChain(sec, rover); + return 0; +} + // R_DEFS //////////// @@ -1356,6 +1557,30 @@ static int lib_rFrame2Char(lua_State *L) return 2; } +// R_SetPlayerSkin technically doesn't exist either, although it's basically just SetPlayerSkin and SetPlayerSkinByNum handled in one place for convenience +static int lib_rSetPlayerSkin(lua_State *L) +{ + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + NOHUD + if (!player) + return LUA_ErrInvalid(L, "player_t"); + if (lua_isnoneornil(L, 2)) + return luaL_error(L, "argument #2 not given (expected number or string)"); + else if (lua_type(L, 2) == LUA_TNUMBER) // skin number + { + INT32 i = luaL_checkinteger(L, 2); + if (i < 0 || i >= MAXSKINS) + return luaL_error(L, "argument #2 cannot exceed MAXSKINS"); + SetPlayerSkinByNum(player-players, i); + } + else // skin name + { + const char *skinname = luaL_checkstring(L, 2); + SetPlayerSkin(player-players, skinname); + } + return 0; +} + // S_SOUND //////////// @@ -1363,6 +1588,7 @@ static int lib_sStartSound(lua_State *L) { const void *origin = NULL; sfxenum_t sound_id = luaL_checkinteger(L, 2); + player_t *player = NULL; NOHUD if (!lua_isnil(L, 1)) { @@ -1370,7 +1596,14 @@ static int lib_sStartSound(lua_State *L) if (!origin) return LUA_ErrInvalid(L, "mobj_t"); } - S_StartSound(origin, sound_id); + if (!lua_isnone(L, 3) && lua_isuserdata(L, 3)) + { + player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER)); + if (!player) + return LUA_ErrInvalid(L, "player_t"); + } + if (!player || P_IsLocalPlayer(player)) + S_StartSound(origin, sound_id); return 0; } @@ -1379,6 +1612,7 @@ static int lib_sStartSoundAtVolume(lua_State *L) const void *origin = NULL; sfxenum_t sound_id = luaL_checkinteger(L, 2); INT32 volume = (INT32)luaL_checkinteger(L, 3); + player_t *player = NULL; NOHUD if (!lua_isnil(L, 1)) { @@ -1386,6 +1620,13 @@ static int lib_sStartSoundAtVolume(lua_State *L) if (!origin) return LUA_ErrInvalid(L, "mobj_t"); } + if (!lua_isnone(L, 4) && lua_isuserdata(L, 4)) + { + player = *((player_t **)luaL_checkudata(L, 4, META_PLAYER)); + if (!player) + return LUA_ErrInvalid(L, "player_t"); + } + if (!player || P_IsLocalPlayer(player)) S_StartSoundAtVolume(origin, sound_id, volume); return 0; } @@ -1404,7 +1645,15 @@ static int lib_sChangeMusic(lua_State *L) { UINT32 music_num = (UINT32)luaL_checkinteger(L, 1); boolean looping = (boolean)lua_opttrueboolean(L, 2); + player_t *player = NULL; NOHUD + if (!lua_isnone(L, 3) && lua_isuserdata(L, 3)) + { + player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER)); + if (!player) + return LUA_ErrInvalid(L, "player_t"); + } + if (!player || P_IsLocalPlayer(player)) S_ChangeMusic(music_num, looping); return 0; } @@ -1413,15 +1662,33 @@ static int lib_sSpeedMusic(lua_State *L) { fixed_t fixedspeed = (fixed_t)luaL_checkinteger(L, 1); float speed = FIXED_TO_FLOAT(fixedspeed); + player_t *player = NULL; NOHUD - lua_pushboolean(L, S_SpeedMusic(speed)); + if (!lua_isnone(L, 2) && lua_isuserdata(L, 2)) + { + player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER)); + if (!player) + return LUA_ErrInvalid(L, "player_t"); + } + if (!player || P_IsLocalPlayer(player)) + lua_pushboolean(L, S_SpeedMusic(speed)); + else + lua_pushboolean(L, false); return 1; } static int lib_sStopMusic(lua_State *L) { + player_t *player = NULL; NOHUD - S_StopMusic(); + if (!lua_isnone(L, 1) && lua_isuserdata(L, 1)) + { + player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + if (!player) + return LUA_ErrInvalid(L, "player_t"); + } + if (!player || P_IsLocalPlayer(player)) + S_StopMusic(); return 0; } @@ -1575,6 +1842,7 @@ static int lib_gTicsToMilliseconds(lua_State *L) static luaL_Reg lib[] = { {"print", lib_print}, + {"EvalMath", lib_evalMath,}, // m_random {"P_Random",lib_pRandom}, @@ -1614,7 +1882,10 @@ static luaL_Reg lib[] = { {"P_BossTargetPlayer",lib_pBossTargetPlayer}, {"P_SupermanLook4Players",lib_pSupermanLook4Players}, {"P_SetScale",lib_pSetScale}, + {"P_InsideANonSolidFFloor",lib_pInsideANonSolidFFloor}, {"P_CheckDeathPitCollide",lib_pCheckDeathPitCollide}, + {"P_CheckSolidLava",lib_pCheckSolidLava}, + {"P_CanRunOnWater",lib_pCanRunOnWater}, // p_user {"P_GetPlayerHeight",lib_pGetPlayerHeight}, @@ -1624,13 +1895,18 @@ static luaL_Reg lib[] = { {"P_PlayerInPain",lib_pPlayerInPain}, {"P_DoPlayerPain",lib_pDoPlayerPain}, {"P_ResetPlayer",lib_pResetPlayer}, + {"P_IsObjectInGoop",lib_pIsObjectInGoop}, {"P_IsObjectOnGround",lib_pIsObjectOnGround}, + {"P_InSpaceSector",lib_pInSpaceSector}, + {"P_InQuicksand",lib_pInQuicksand}, {"P_SetObjectMomZ",lib_pSetObjectMomZ}, {"P_RestoreMusic",lib_pRestoreMusic}, + {"P_SpawnShieldOrb",lib_pSpawnShieldOrb}, {"P_SpawnGhostMobj",lib_pSpawnGhostMobj}, {"P_GivePlayerRings",lib_pGivePlayerRings}, {"P_GivePlayerLives",lib_pGivePlayerLives}, {"P_ResetScore",lib_pResetScore}, + {"P_DoJumpShield",lib_pDoJumpShield}, {"P_BlackOw",lib_pBlackOw}, {"P_ElementalFireTrail",lib_pElementalFireTrail}, {"P_DoPlayerExit",lib_pDoPlayerExit}, @@ -1642,6 +1918,9 @@ static luaL_Reg lib[] = { {"P_HomingAttack",lib_pHomingAttack}, {"P_SuperReady",lib_pSuperReady}, {"P_DoJump",lib_pDoJump}, + {"P_SpawnThokMobj",lib_pSpawnThokMobj}, + {"P_SpawnSpinMobj",lib_pSpawnSpinMobj}, + {"P_Telekinesis",lib_pTelekinesis}, // p_map {"P_CheckPosition",lib_pCheckPosition}, @@ -1654,6 +1933,7 @@ static luaL_Reg lib[] = { {"P_CheckHoopPosition",lib_pCheckHoopPosition}, {"P_RadiusAttack",lib_pRadiusAttack}, {"P_FloorzAtPos",lib_pFloorzAtPos}, + {"P_DoSpring",lib_pDoSpring}, // p_inter {"P_RemoveShield",lib_pRemoveShield}, @@ -1683,9 +1963,11 @@ static luaL_Reg lib[] = { {"P_SpawnLightningFlash",lib_pSpawnLightningFlash}, {"P_FadeLight",lib_pFadeLight}, {"P_ThingOnSpecial3DFloor",lib_pThingOnSpecial3DFloor}, + {"P_IsFlagAtBase",lib_pIsFlagAtBase}, {"P_SetupLevelSky",lib_pSetupLevelSky}, {"P_SetSkyboxMobj",lib_pSetSkyboxMobj}, {"P_StartQuake",lib_pStartQuake}, + {"EV_CrumbleChain",lib_evCrumbleChain}, // r_defs {"R_PointToAngle",lib_rPointToAngle}, @@ -1697,6 +1979,7 @@ static luaL_Reg lib[] = { // r_things (sprite) {"R_Char2Frame",lib_rChar2Frame}, {"R_Frame2Char",lib_rFrame2Char}, + {"R_SetPlayerSkin",lib_rSetPlayerSkin}, // s_sound {"S_StartSound",lib_sStartSound}, diff --git a/src/lua_hook.h b/src/lua_hook.h index 0c22092a2..85d00533b 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -33,9 +33,15 @@ enum hook { hook_MobjDeath, hook_BossDeath, hook_MobjRemoved, + hook_JumpSpecial, + hook_AbilitySpecial, + hook_SpinSpecial, + hook_JumpSpinSpecial, hook_BotTiccmd, hook_BotAI, hook_LinedefExecute, + hook_PlayerMsg, + hook_DeathMsg, hook_MAX // last hook }; @@ -46,6 +52,7 @@ void LUAh_MapLoad(void); // Hook for map load void LUAh_PlayerJoin(int playernum); // Hook for Got_AddPlayer void LUAh_ThinkFrame(void); // Hook for frame (after mobj and player thinkers) boolean LUAh_MobjHook(mobj_t *mo, enum hook which); +boolean LUAh_PlayerHook(player_t *plr, enum hook which); #define LUAh_MobjSpawn(mo) LUAh_MobjHook(mo, hook_MobjSpawn) // Hook for P_SpawnMobj by mobj type UINT8 LUAh_MobjCollide(mobj_t *thing1, mobj_t *thing2); // Hook for PIT_CheckThing by (thing) mobj type UINT8 LUAh_MobjMoveCollide(mobj_t *thing1, mobj_t *thing2); // Hook for PIT_CheckThing by (tmthing) mobj type @@ -58,8 +65,14 @@ boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source); // Hook for P_KillMobj by mobj type #define LUAh_BossDeath(mo) LUAh_MobjHook(mo, hook_BossDeath) // Hook for A_BossDeath by mobj type #define LUAh_MobjRemoved(mo) LUAh_MobjHook(mo, hook_MobjRemoved) // Hook for P_RemoveMobj by mobj type +#define LUAh_JumpSpecial(player) LUAh_PlayerHook(player, hook_JumpSpecial) // Hook for P_DoJumpStuff (Any-jumping) +#define LUAh_AbilitySpecial(player) LUAh_PlayerHook(player, hook_AbilitySpecial) // Hook for P_DoJumpStuff (Double-jumping) +#define LUAh_SpinSpecial(player) LUAh_PlayerHook(player, hook_SpinSpecial) // Hook for P_DoSpinDash (Spin button effect) +#define LUAh_JumpSpinSpecial(player) LUAh_PlayerHook(player, hook_JumpSpinSpecial) // Hook for P_DoJumpStuff (Spin button effect (mid-air)) boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd); // Hook for B_BuildTiccmd boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_BuildTailsTiccmd by skin name boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo); // Hook for linedef executors +boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook for chat messages +boolean LUAh_DeathMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages #endif diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index ed9f53d2c..4e9328e1c 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -14,6 +14,7 @@ #ifdef HAVE_BLUA #include "doomstat.h" #include "p_mobj.h" +#include "g_game.h" #include "r_things.h" #include "b_bot.h" #include "z_zone.h" @@ -43,9 +44,15 @@ const char *const hookNames[hook_MAX+1] = { "MobjDeath", "BossDeath", "MobjRemoved", + "JumpSpecial", + "AbilitySpecial", + "SpinSpecial", + "JumpSpinSpecial", "BotTiccmd", "BotAI", "LinedefExecute", + "PlayerMsg", + "HurtMsg", NULL }; @@ -319,6 +326,42 @@ boolean LUAh_MobjHook(mobj_t *mo, enum hook which) return hooked; } +boolean LUAh_PlayerHook(player_t *plr, enum hook which) +{ + boolean hooked = false; + if (!gL || !(hooksAvailable[which/8] & (1<<(which%8)))) + return false; + + // clear the stack (just in case) + lua_pop(gL, -1); + + // hook table + lua_getfield(gL, LUA_REGISTRYINDEX, "hook"); + I_Assert(lua_istable(gL, -1)); + lua_rawgeti(gL, -1, which); + lua_remove(gL, -2); + I_Assert(lua_istable(gL, -1)); + + LUA_PushUserdata(gL, plr, META_PLAYER); + + lua_pushnil(gL); + while (lua_next(gL, -3) != 0) { + lua_pushvalue(gL, -3); // player + if (lua_pcall(gL, 1, 1, 0)) { // pops hook function, player, pushes 1 return result + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1)); + lua_pop(gL, 1); + continue; + } + if (lua_toboolean(gL, -1)) // if return true, + hooked = true; // override vanilla behavior + lua_pop(gL, 1); // pop return value + } + + lua_pop(gL, -1); + lua_gc(gL, LUA_GCSTEP, 1); + return hooked; +} + // Hook for map change (before load) void LUAh_MapChange(void) { @@ -862,4 +905,99 @@ boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo) return true; } +// Hook for PlayerMsg -Red +boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg) +{ + boolean handled = false; + + if (!gL || !(hooksAvailable[hook_PlayerMsg/8] & (1<<(hook_PlayerMsg%8)))) + return false; + + lua_getfield(gL, LUA_REGISTRYINDEX, "hook"); + I_Assert(lua_istable(gL, -1)); + lua_rawgeti(gL, -1, hook_PlayerMsg); + lua_remove(gL, -2); + I_Assert(lua_istable(gL, -1)); + + LUA_PushUserdata(gL, &players[source], META_PLAYER); // Source player + + if (flags & 2 /*HU_CSAY*/) { // csay TODO: make HU_CSAY accessible outside hu_stuff.c + lua_pushinteger(gL, 3); // type + lua_pushnil(gL); // target + } else if (target == -1) { // sayteam + lua_pushinteger(gL, 1); // type + lua_pushnil(gL); // target + } else if (target == 0) { // say + lua_pushinteger(gL, 0); // type + lua_pushnil(gL); // target + } else { // sayto + lua_pushinteger(gL, 2); // type + LUA_PushUserdata(gL, &players[target-1], META_PLAYER); // target + } + + lua_pushstring(gL, msg); // msg + + lua_pushnil(gL); + + while (lua_next(gL, -6)) { + lua_pushvalue(gL, -6); // source + lua_pushvalue(gL, -6); // type + lua_pushvalue(gL, -6); // target + lua_pushvalue(gL, -6); // msg + if (lua_pcall(gL, 4, 1, 0)) { + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1)); + lua_pop(gL, 1); + continue; + } + if (lua_toboolean(gL, -1)) + handled = true; + lua_pop(gL, 1); // pop return value + } + lua_pop(gL, 4); // pop arguments and mobjtype table + + lua_gc(gL, LUA_GCSTEP, 1); + return handled; +} + +// Hook for hurt messages -Red +// The internal name is DeathMsg, but the API name is "HurtMsg". Keep that in mind. (Should this be fixed at some point?) +// @TODO This hook should be fixed to take mobj type at the addHook parameter to compare to inflictor. (I couldn't get this to work without crashing) +boolean LUAh_DeathMsg(player_t *player, mobj_t *inflictor, mobj_t *source) +{ + boolean handled = false; + + if (!gL || !(hooksAvailable[hook_DeathMsg/8] & (1<<(hook_DeathMsg%8)))) + return false; + + lua_getfield(gL, LUA_REGISTRYINDEX, "hook"); + I_Assert(lua_istable(gL, -1)); + lua_rawgeti(gL, -1, hook_DeathMsg); + lua_remove(gL, -2); + I_Assert(lua_istable(gL, -1)); + + LUA_PushUserdata(gL, player, META_PLAYER); // Player + LUA_PushUserdata(gL, inflictor, META_MOBJ); // Inflictor + LUA_PushUserdata(gL, source, META_MOBJ); // Source + + lua_pushnil(gL); + + while (lua_next(gL, -5)) { + lua_pushvalue(gL, -5); // player + lua_pushvalue(gL, -5); // inflictor + lua_pushvalue(gL, -5); // source + if (lua_pcall(gL, 3, 1, 0)) { + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1)); + lua_pop(gL, 1); + continue; + } + if (lua_toboolean(gL, -1)) + handled = true; + lua_pop(gL, 1); // pop return value + } + lua_pop(gL, 3); // pop arguments and mobjtype table + + lua_gc(gL, LUA_GCSTEP, 1); + return handled; +} + #endif diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 176b816ec..f388a1ff4 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -15,6 +15,7 @@ #include "r_defs.h" #include "st_stuff.h" // hudinfo[] #include "g_game.h" +#include "p_local.h" // camera_t #include "v_video.h" #include "w_wad.h" #include "z_zone.h" @@ -23,6 +24,8 @@ #include "lua_libs.h" #include "lua_hud.h" +#define HUDONLY if (!hud_running) return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!"); + boolean hud_running = false; static UINT8 hud_enabled[(hud_MAX/8)+1]; @@ -85,17 +88,79 @@ static const char *const hudhook_opt[] = { "scores", NULL}; +// alignment types for v.drawString enum align { align_left = 0, align_center, align_right, - align_fixed + align_fixed, + align_small, + align_smallright, + align_thin, + align_thinright }; static const char *const align_opt[] = { "left", "center", "right", "fixed", + "small", + "small-right", + "thin", + "thin-right", + NULL}; + +// width types for v.stringWidth +enum widtht { + widtht_normal = 0, + widtht_small, + widtht_thin +}; +static const char *const widtht_opt[] = { + "normal", + "small", + "thin", + NULL}; + +enum cameraf { + camera_chase = 0, + camera_aiming, + camera_viewheight, + camera_startangle, + camera_x, + camera_y, + camera_z, + camera_angle, + camera_subsector, + camera_floorz, + camera_ceilingz, + camera_radius, + camera_height, + camera_relativex, + camera_momx, + camera_momy, + camera_momz +}; + + +static const char *const camera_opt[] = { + "chase", + "aiming", + "viewheight", + "startangle", + "x", + "y", + "z", + "angle", + "subsector", + "floorz", + "ceilingz", + "radius", + "height", + "relativex", + "momx", + "momy", + "momz", NULL}; static int lib_getHudInfo(lua_State *L) @@ -193,24 +258,85 @@ static int patch_set(lua_State *L) return luaL_error(L, LUA_QL("patch_t") " struct cannot be edited by Lua."); } +static int camera_get(lua_State *L) +{ + camera_t *cam = *((camera_t **)luaL_checkudata(L, 1, META_CAMERA)); + enum cameraf field = luaL_checkoption(L, 2, NULL, camera_opt); + + // cameras should always be valid unless I'm a nutter + I_Assert(cam != NULL); + + switch (field) + { + case camera_chase: + lua_pushboolean(L, cam->chase); + break; + case camera_aiming: + lua_pushinteger(L, cam->aiming); + break; + case camera_viewheight: + lua_pushinteger(L, cam->viewheight); + break; + case camera_startangle: + lua_pushinteger(L, cam->startangle); + break; + case camera_x: + lua_pushinteger(L, cam->x); + break; + case camera_y: + lua_pushinteger(L, cam->y); + break; + case camera_z: + lua_pushinteger(L, cam->z); + break; + case camera_angle: + lua_pushinteger(L, cam->angle); + break; + case camera_subsector: + LUA_PushUserdata(L, cam->subsector, META_SUBSECTOR); + break; + case camera_floorz: + lua_pushinteger(L, cam->floorz); + break; + case camera_ceilingz: + lua_pushinteger(L, cam->ceilingz); + break; + case camera_radius: + lua_pushinteger(L, cam->radius); + break; + case camera_height: + lua_pushinteger(L, cam->height); + break; + case camera_relativex: + lua_pushinteger(L, cam->relativex); + break; + case camera_momx: + lua_pushinteger(L, cam->momx); + break; + case camera_momy: + lua_pushinteger(L, cam->momy); + break; + case camera_momz: + lua_pushinteger(L, cam->momz); + break; + } + return 1; +} + // // lib_draw // static int libd_patchExists(lua_State *L) { - if (!hud_running) - return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!"); - + HUDONLY lua_pushboolean(L, W_LumpExists(luaL_checkstring(L, 1))); return 1; } static int libd_cachePatch(lua_State *L) { - if (!hud_running) - return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!"); - + HUDONLY LUA_PushUserdata(L, W_CachePatchName(luaL_checkstring(L, 1), PU_STATIC), META_PATCH); return 1; } @@ -221,9 +347,7 @@ static int libd_draw(lua_State *L) patch_t *patch; const UINT8 *colormap = NULL; - if (!hud_running) - return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!"); - + HUDONLY x = luaL_checkinteger(L, 1); y = luaL_checkinteger(L, 2); patch = *((patch_t **)luaL_checkudata(L, 3, META_PATCH)); @@ -244,9 +368,7 @@ static int libd_drawScaled(lua_State *L) patch_t *patch; const UINT8 *colormap = NULL; - if (!hud_running) - return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!"); - + HUDONLY x = luaL_checkinteger(L, 1); y = luaL_checkinteger(L, 2); scale = luaL_checkinteger(L, 3); @@ -264,9 +386,7 @@ static int libd_drawScaled(lua_State *L) static int libd_drawNum(lua_State *L) { INT32 x, y, flags, num; - if (!hud_running) - return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!"); - + HUDONLY x = luaL_checkinteger(L, 1); y = luaL_checkinteger(L, 2); num = luaL_checkinteger(L, 3); @@ -280,9 +400,7 @@ static int libd_drawNum(lua_State *L) static int libd_drawPaddedNum(lua_State *L) { INT32 x, y, flags, num, digits; - if (!hud_running) - return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!"); - + HUDONLY x = luaL_checkinteger(L, 1); y = luaL_checkinteger(L, 2); num = abs(luaL_checkinteger(L, 3)); @@ -302,9 +420,7 @@ static int libd_drawFill(lua_State *L) INT32 h = luaL_optinteger(L, 4, BASEVIDHEIGHT); INT32 c = luaL_optinteger(L, 5, 31); - if (!hud_running) - return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!"); - + HUDONLY V_DrawFill(x, y, w, h, c); return 0; } @@ -319,11 +435,10 @@ static int libd_drawString(lua_State *L) flags &= ~V_PARAMMASK; // Don't let crashes happen. - if (!hud_running) - return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!"); - + HUDONLY switch(align) { + // hu_font case align_left: V_DrawString(x, y, flags, str); break; @@ -336,6 +451,20 @@ static int libd_drawString(lua_State *L) case align_fixed: V_DrawStringAtFixed(x, y, flags, str); break; + // hu_font, 0.5x scale + case align_small: + V_DrawSmallString(x, y, flags, str); + break; + case align_smallright: + V_DrawRightAlignedSmallString(x, y, flags, str); + break; + // tny_font + case align_thin: + V_DrawThinString(x, y, flags, str); + break; + case align_thinright: + V_DrawRightAlignedThinString(x, y, flags, str); + break; } return 0; } @@ -344,11 +473,21 @@ static int libd_stringWidth(lua_State *L) { const char *str = luaL_checkstring(L, 1); INT32 flags = luaL_optinteger(L, 2, V_ALLOWLOWERCASE); + enum widtht widtht = luaL_checkoption(L, 3, "normal", widtht_opt); - if (!hud_running) - return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!"); - - lua_pushinteger(L, V_StringWidth(str, flags)); + HUDONLY + switch(widtht) + { + case widtht_normal: // hu_font + lua_pushinteger(L, V_StringWidth(str, flags)); + break; + case widtht_small: // hu_font, 0.5x scale + lua_pushinteger(L, V_SmallStringWidth(str, flags)); + break; + case widtht_thin: // tny_font + lua_pushinteger(L, V_ThinStringWidth(str, flags)); + break; + } return 1; } @@ -462,6 +601,11 @@ int LUA_HudLib(lua_State *L) lua_setfield(L, -2, "__newindex"); lua_pop(L,1); + luaL_newmetatable(L, META_CAMERA); + lua_pushcfunction(L, camera_get); + lua_setfield(L, -2, "__index"); + lua_pop(L,1); + luaL_register(L, "hud", lib_hud); return 0; } @@ -474,7 +618,7 @@ boolean LUA_HudEnabled(enum hud option) } // Hook for HUD rendering -void LUAh_GameHUD(player_t *stplyr) +void LUAh_GameHUD(player_t *stplayr) { if (!gL || !(hudAvailable & (1< end'."); + + if (!lua_isnil(L, 1)) + state = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); + else + return 0; // no thinglist to iterate through sorry! + + lua_settop(L, 2); + lua_remove(L, 1); // remove state now. + + if (!lua_isnil(L, 1)) + { + thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); + thing = thing->snext; + } + else + thing = state; // state is used as the "start" of the thinglist + + if (thing) + { + LUA_PushUserdata(L, thing, META_MOBJ); + return 1; + } + return 0; +} + +// iterates through the ffloors list in a sector! +static int lib_iterateSectorFFloors(lua_State *L) +{ + ffloor_t *state = NULL; + ffloor_t *ffloor = NULL; + + if (lua_gettop(L) < 2) + return luaL_error(L, "Don't call sector.ffloors() directly, use it as 'for rover in sector.ffloors do end'."); + + if (!lua_isnil(L, 1)) + state = *((ffloor_t **)luaL_checkudata(L, 1, META_FFLOOR)); + else + return 0; // no ffloors to iterate through sorry! + + lua_settop(L, 2); + lua_remove(L, 1); // remove state now. + + if (!lua_isnil(L, 1)) + { + ffloor = *((ffloor_t **)luaL_checkudata(L, 1, META_FFLOOR)); + ffloor = ffloor->next; + } + else + ffloor = state; // state is used as the "start" of the ffloor list + + if (ffloor) + { + LUA_PushUserdata(L, ffloor, META_FFLOOR); + return 1; + } + return 0; +} + +static int sector_iterate(lua_State *L) +{ + lua_pushvalue(L, lua_upvalueindex(1)); // iterator function, or the "generator" + lua_pushvalue(L, lua_upvalueindex(2)); // state (used as the "start" of the list for our purposes + lua_pushnil(L); // initial value (unused) + return 3; +} + static int sector_get(lua_State *L) { sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); - int field = luaL_checkoption(L, 2, sector_opt[0], sector_opt); + enum sector_e field = luaL_checkoption(L, 2, sector_opt[0], sector_opt); if (!sector) { - if (field == 0) { + if (field == sector_valid) { lua_pushboolean(L, 0); return 1; } @@ -100,16 +278,16 @@ static int sector_get(lua_State *L) switch(field) { - case 0: // valid + case sector_valid: // valid lua_pushboolean(L, 1); return 1; - case 1: + case sector_floorheight: lua_pushinteger(L, sector->floorheight); return 1; - case 2: + case sector_ceilingheight: lua_pushinteger(L, sector->ceilingheight); return 1; - case 3: { // floorpic + case sector_floorpic: { // floorpic levelflat_t *levelflat; INT16 i; for (i = 0, levelflat = levelflats; i != sector->floorpic; i++, levelflat++) @@ -117,7 +295,7 @@ static int sector_get(lua_State *L) lua_pushlstring(L, levelflat->name, 8); return 1; } - case 4: { // ceilingpic + case sector_ceilingpic: { // ceilingpic levelflat_t *levelflat; INT16 i; for (i = 0, levelflat = levelflats; i != sector->ceilingpic; i++, levelflat++) @@ -125,15 +303,35 @@ static int sector_get(lua_State *L) lua_pushlstring(L, levelflat->name, 8); return 1; } - case 5: + case sector_lightlevel: lua_pushinteger(L, sector->lightlevel); return 1; - case 6: + case sector_special: lua_pushinteger(L, sector->special); return 1; - case 7: + case sector_tag: lua_pushinteger(L, sector->tag); return 1; + case sector_thinglist: // thinglist + lua_pushcfunction(L, lib_iterateSectorThinglist); + LUA_PushUserdata(L, sector->thinglist, META_MOBJ); + lua_pushcclosure(L, sector_iterate, 2); // push lib_iterateSectorThinglist and sector->thinglist as upvalues for the function + return 1; + case sector_heightsec: // heightsec - fake floor heights + if (sector->heightsec < 0) + return 0; + LUA_PushUserdata(L, §ors[sector->heightsec], META_SECTOR); + return 1; + case sector_camsec: // camsec - camera clipping heights + if (sector->camsec < 0) + return 0; + LUA_PushUserdata(L, §ors[sector->camsec], META_SECTOR); + return 1; + case sector_ffloors: // ffloors + lua_pushcfunction(L, lib_iterateSectorFFloors); + LUA_PushUserdata(L, sector->ffloors, META_FFLOOR); + lua_pushcclosure(L, sector_iterate, 2); // push lib_iterateFFloors and sector->ffloors as upvalues for the function + return 1; } return 0; } @@ -181,7 +379,7 @@ static INT32 P_AddLevelFlatRuntime(const char *flatname) static int sector_set(lua_State *L) { sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); - int field = luaL_checkoption(L, 2, sector_opt[0], sector_opt); + enum sector_e field = luaL_checkoption(L, 2, sector_opt[0], sector_opt); if (!sector) return luaL_error(L, "accessed sector_t doesn't exist anymore."); @@ -191,10 +389,14 @@ static int sector_set(lua_State *L) switch(field) { - case 0: // valid + case sector_valid: // valid + case sector_thinglist: // thinglist + case sector_heightsec: // heightsec + case sector_camsec: // camsec + case sector_ffloors: // ffloors default: return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]); - case 1: { // floorheight + case sector_floorheight: { // floorheight boolean flag; fixed_t lastpos = sector->floorheight; sector->floorheight = (fixed_t)luaL_checkinteger(L, 3); @@ -206,7 +408,7 @@ static int sector_set(lua_State *L) } break; } - case 2: { // ceilingheight + case sector_ceilingheight: { // ceilingheight boolean flag; fixed_t lastpos = sector->ceilingheight; sector->ceilingheight = (fixed_t)luaL_checkinteger(L, 3); @@ -218,19 +420,19 @@ static int sector_set(lua_State *L) } break; } - case 3: + case sector_floorpic: sector->floorpic = P_AddLevelFlatRuntime(luaL_checkstring(L, 3)); break; - case 4: + case sector_ceilingpic: sector->ceilingpic = P_AddLevelFlatRuntime(luaL_checkstring(L, 3)); break; - case 5: + case sector_lightlevel: sector->lightlevel = (INT16)luaL_checkinteger(L, 3); break; - case 6: + case sector_special: sector->special = (INT16)luaL_checkinteger(L, 3); break; - case 7: + case sector_tag: P_ChangeSectorTag((UINT32)(sector - sectors), (INT16)luaL_checkinteger(L, 3)); break; } @@ -247,11 +449,11 @@ static int sector_num(lua_State *L) static int subsector_get(lua_State *L) { subsector_t *subsector = *((subsector_t **)luaL_checkudata(L, 1, META_SUBSECTOR)); - int field = luaL_checkoption(L, 2, subsector_opt[0], subsector_opt); + enum subsector_e field = luaL_checkoption(L, 2, subsector_opt[0], subsector_opt); if (!subsector) { - if (field == 0) { + if (field == subsector_valid) { lua_pushboolean(L, 0); return 1; } @@ -260,19 +462,19 @@ static int subsector_get(lua_State *L) switch(field) { - case 0: // valid + case subsector_valid: // valid lua_pushboolean(L, 1); return 1; - case 1: + case subsector_sector: LUA_PushUserdata(L, subsector->sector, META_SECTOR); return 1; - case 2: + case subsector_numlines: lua_pushinteger(L, subsector->numlines); return 1; - case 3: + case subsector_firstline: lua_pushinteger(L, subsector->firstline); return 1; - case 4: + case subsector_validcount: lua_pushinteger(L, subsector->validcount); return 1; } @@ -289,11 +491,11 @@ static int subsector_num(lua_State *L) static int line_get(lua_State *L) { line_t *line = *((line_t **)luaL_checkudata(L, 1, META_LINE)); - int field = luaL_checkoption(L, 2, line_opt[0], line_opt); + enum line_e field = luaL_checkoption(L, 2, line_opt[0], line_opt); if (!line) { - if (field == 0) { + if (field == line_valid) { lua_pushboolean(L, 0); return 1; } @@ -302,43 +504,43 @@ static int line_get(lua_State *L) switch(field) { - case 0: // valid + case line_valid: // valid lua_pushboolean(L, 1); return 1; - case 1: + case line_v1: LUA_PushUserdata(L, line->v1, META_VERTEX); return 1; - case 2: + case line_v2: LUA_PushUserdata(L, line->v2, META_VERTEX); return 1; - case 3: + case line_dx: lua_pushinteger(L, line->dx); return 1; - case 4: + case line_dy: lua_pushinteger(L, line->dy); return 1; - case 5: + case line_flags: lua_pushinteger(L, line->flags); return 1; - case 6: + case line_special: lua_pushinteger(L, line->special); return 1; - case 7: + case line_tag: lua_pushinteger(L, line->tag); return 1; - case 8: + case line_sidenum: LUA_PushUserdata(L, line->sidenum, META_SIDENUM); return 1; - case 9: // frontside + case line_frontside: // frontside LUA_PushUserdata(L, &sides[line->sidenum[0]], META_SIDE); return 1; - case 10: // backside + case line_backside: // backside if (line->sidenum[1] == 0xffff) return 0; LUA_PushUserdata(L, &sides[line->sidenum[1]], META_SIDE); return 1; - case 11: - switch(lines->slopetype) + case line_slopetype: + switch(line->slopetype) { case ST_HORIZONTAL: lua_pushliteral(L, "horizontal"); @@ -354,22 +556,22 @@ static int line_get(lua_State *L) break; } return 1; - case 12: + case line_frontsector: LUA_PushUserdata(L, line->frontsector, META_SECTOR); return 1; - case 13: + case line_backsector: LUA_PushUserdata(L, line->backsector, META_SECTOR); return 1; - case 14: + case line_validcount: lua_pushinteger(L, line->validcount); return 1; - case 15: + case line_firsttag: lua_pushinteger(L, line->firsttag); return 1; - case 16: + case line_nexttag: lua_pushinteger(L, line->nexttag); return 1; - case 17: + case line_text: lua_pushstring(L, line->text); return 1; } @@ -414,11 +616,11 @@ static int sidenum_get(lua_State *L) static int side_get(lua_State *L) { side_t *side = *((side_t **)luaL_checkudata(L, 1, META_SIDE)); - int field = luaL_checkoption(L, 2, side_opt[0], side_opt); + enum side_e field = luaL_checkoption(L, 2, side_opt[0], side_opt); if (!side) { - if (field == 0) { + if (field == side_valid) { lua_pushboolean(L, 0); return 1; } @@ -427,34 +629,34 @@ static int side_get(lua_State *L) switch(field) { - case 0: // valid + case side_valid: // valid lua_pushboolean(L, 1); return 1; - case 1: + case side_textureoffset: lua_pushinteger(L, side->textureoffset); return 1; - case 2: + case side_rowoffset: lua_pushinteger(L, side->rowoffset); return 1; - case 3: + case side_toptexture: lua_pushinteger(L, side->toptexture); return 1; - case 4: + case side_bottomtexture: lua_pushinteger(L, side->bottomtexture); return 1; - case 5: + case side_midtexture: lua_pushinteger(L, side->midtexture); return 1; - case 6: + case side_sector: LUA_PushUserdata(L, side->sector, META_SECTOR); return 1; - case 7: + case side_special: lua_pushinteger(L, side->special); return 1; - case 8: + case side_repeatcnt: lua_pushinteger(L, side->repeatcnt); return 1; - case 9: + case side_text: lua_pushstring(L, side->text); return 1; } @@ -471,11 +673,11 @@ static int side_num(lua_State *L) static int vertex_get(lua_State *L) { vertex_t *vertex = *((vertex_t **)luaL_checkudata(L, 1, META_VERTEX)); - int field = luaL_checkoption(L, 2, vertex_opt[0], vertex_opt); + enum vertex_e field = luaL_checkoption(L, 2, vertex_opt[0], vertex_opt); if (!vertex) { - if (field == 0) { + if (field == vertex_valid) { lua_pushboolean(L, 0); return 1; } @@ -484,16 +686,16 @@ static int vertex_get(lua_State *L) switch(field) { - case 0: // valid + case vertex_valid: // valid lua_pushboolean(L, 1); return 1; - case 1: + case vertex_x: lua_pushinteger(L, vertex->x); return 1; - case 2: + case vertex_y: lua_pushinteger(L, vertex->y); return 1; - case 3: + case vertex_z: lua_pushinteger(L, vertex->z); return 1; } @@ -737,6 +939,248 @@ static int lib_numvertexes(lua_State *L) return 1; } +static int ffloor_get(lua_State *L) +{ + ffloor_t *ffloor = *((ffloor_t **)luaL_checkudata(L, 1, META_FFLOOR)); + enum ffloor_e field = luaL_checkoption(L, 2, ffloor_opt[0], ffloor_opt); + + if (!ffloor) + { + if (field == ffloor_valid) { + lua_pushboolean(L, 0); + return 1; + } + return luaL_error(L, "accessed ffloor_t doesn't exist anymore."); + } + + switch(field) + { + case ffloor_valid: // valid + lua_pushboolean(L, 1); + return 1; + case ffloor_topheight: + lua_pushinteger(L, *ffloor->topheight); + return 1; + case ffloor_toppic: { // toppic + levelflat_t *levelflat; + INT16 i; + for (i = 0, levelflat = levelflats; i != *ffloor->toppic; i++, levelflat++) + ; + lua_pushlstring(L, levelflat->name, 8); + return 1; + } + case ffloor_toplightlevel: + lua_pushinteger(L, *ffloor->toplightlevel); + return 1; + case ffloor_bottomheight: + lua_pushinteger(L, *ffloor->bottomheight); + return 1; + case ffloor_bottompic: { // bottompic + levelflat_t *levelflat; + INT16 i; + for (i = 0, levelflat = levelflats; i != *ffloor->bottompic; i++, levelflat++) + ; + lua_pushlstring(L, levelflat->name, 8); + return 1; + } + case ffloor_sector: + LUA_PushUserdata(L, §ors[ffloor->secnum], META_SECTOR); + return 1; + case ffloor_flags: + lua_pushinteger(L, ffloor->flags); + return 1; + case ffloor_master: + LUA_PushUserdata(L, ffloor->master, META_LINE); + return 1; + case ffloor_target: + LUA_PushUserdata(L, ffloor->target, META_SECTOR); + return 1; + case ffloor_next: + LUA_PushUserdata(L, ffloor->next, META_FFLOOR); + return 1; + case ffloor_prev: + LUA_PushUserdata(L, ffloor->prev, META_FFLOOR); + return 1; + case ffloor_alpha: + lua_pushinteger(L, ffloor->alpha); + return 1; + } + return 0; +} + +static int ffloor_set(lua_State *L) +{ + ffloor_t *ffloor = *((ffloor_t **)luaL_checkudata(L, 1, META_FFLOOR)); + enum ffloor_e field = luaL_checkoption(L, 2, ffloor_opt[0], ffloor_opt); + + if (!ffloor) + return luaL_error(L, "accessed ffloor_t doesn't exist anymore."); + + if (hud_running) + return luaL_error(L, "Do not alter ffloor_t in HUD rendering code!"); + + switch(field) + { + case ffloor_valid: // valid + case ffloor_sector: // sector + case ffloor_master: // master + case ffloor_target: // target + case ffloor_next: // next + case ffloor_prev: // prev + default: + return luaL_error(L, "ffloor_t field " LUA_QS " cannot be set.", ffloor_opt[field]); + case ffloor_topheight: { // topheight + boolean flag; + fixed_t lastpos = *ffloor->topheight; + sector_t *sector = §ors[ffloor->secnum]; + sector->floorheight = (fixed_t)luaL_checkinteger(L, 3); + flag = P_CheckSector(sector, true); + if (flag && sector->numattached) + { + *ffloor->topheight = lastpos; + P_CheckSector(sector, true); + } + break; + } + case ffloor_toppic: + *ffloor->toppic = P_AddLevelFlatRuntime(luaL_checkstring(L, 3)); + break; + case ffloor_toplightlevel: + *ffloor->toplightlevel = (INT16)luaL_checkinteger(L, 3); + break; + case ffloor_bottomheight: { // bottomheight + boolean flag; + fixed_t lastpos = *ffloor->bottomheight; + sector_t *sector = §ors[ffloor->secnum]; + sector->ceilingheight = (fixed_t)luaL_checkinteger(L, 3); + flag = P_CheckSector(sector, true); + if (flag && sector->numattached) + { + *ffloor->bottomheight = lastpos; + P_CheckSector(sector, true); + } + break; + } + case ffloor_bottompic: + *ffloor->bottompic = P_AddLevelFlatRuntime(luaL_checkstring(L, 3)); + break; + case ffloor_flags: + ffloor->flags = luaL_checkinteger(L, 3); + break; + case ffloor_alpha: + ffloor->alpha = (INT32)luaL_checkinteger(L, 3); + break; + } + return 0; +} + +static int lib_getMapheaderinfo(lua_State *L) +{ + // i -> mapheaderinfo[i-1] + + //int field; + lua_settop(L, 2); + lua_remove(L, 1); // dummy userdata table is unused. + if (lua_isnumber(L, 1)) + { + size_t i = lua_tointeger(L, 1)-1; + if (i >= NUMMAPS) + return 0; + LUA_PushUserdata(L, mapheaderinfo[i], META_MAPHEADER); + //CONS_Printf(mapheaderinfo[i]->lvlttl); + return 1; + }/* + field = luaL_checkoption(L, 1, NULL, array_opt); + switch(field) + { + case 0: // iterate + lua_pushcfunction(L, lib_iterateSubsectors); + return 1; + }*/ + return 0; +} + +static int lib_nummapheaders(lua_State *L) +{ + lua_pushinteger(L, NUMMAPS); + return 1; +} + +static int mapheaderinfo_get(lua_State *L) +{ + mapheader_t *header = *((mapheader_t **)luaL_checkudata(L, 1, META_MAPHEADER)); + const char *field = luaL_checkstring(L, 2); + //INT16 i; + if (fastcmp(field,"lvlttl")) { + //for (i = 0; i < 21; i++) + // if (!header->lvlttl[i]) + // break; + lua_pushlstring(L, header->lvlttl, 21); + } else if (fastcmp(field,"subttl")) + lua_pushlstring(L, header->subttl, 32); + else if (fastcmp(field,"actnum")) + lua_pushinteger(L, header->actnum); + else if (fastcmp(field,"typeoflevel")) + lua_pushinteger(L, header->typeoflevel); + else if (fastcmp(field,"nextlevel")) + lua_pushinteger(L, header->nextlevel); + else if (fastcmp(field,"musicslot")) + lua_pushinteger(L, header->musicslot); + else if (fastcmp(field,"musicslottrack")) + lua_pushinteger(L, header->musicslottrack); + else if (fastcmp(field,"forcecharacter")) + lua_pushlstring(L, header->forcecharacter, 16); + else if (fastcmp(field,"weather")) + lua_pushinteger(L, header->weather); + else if (fastcmp(field,"skynum")) + lua_pushinteger(L, header->skynum); + else if (fastcmp(field,"skybox_scalex")) + lua_pushinteger(L, header->skybox_scalex); + else if (fastcmp(field,"skybox_scaley")) + lua_pushinteger(L, header->skybox_scaley); + else if (fastcmp(field,"skybox_scalez")) + lua_pushinteger(L, header->skybox_scalez); + else if (fastcmp(field,"interscreen")) + lua_pushlstring(L, header->interscreen, 8); + else if (fastcmp(field,"runsoc")) + lua_pushlstring(L, header->runsoc, 32); + else if (fastcmp(field,"scriptname")) + lua_pushlstring(L, header->scriptname, 32); + else if (fastcmp(field,"precutscenenum")) + lua_pushinteger(L, header->precutscenenum); + else if (fastcmp(field,"cutscenenum")) + lua_pushinteger(L, header->cutscenenum); + else if (fastcmp(field,"countdown")) + lua_pushinteger(L, header->countdown); + else if (fastcmp(field,"palette")) + lua_pushinteger(L, header->palette); + else if (fastcmp(field,"numlaps")) + lua_pushinteger(L, header->numlaps); + else if (fastcmp(field,"unlockrequired")) + lua_pushinteger(L, header->unlockrequired); + else if (fastcmp(field,"levelselect")) + lua_pushinteger(L, header->levelselect); + else if (fastcmp(field,"bonustype")) + lua_pushinteger(L, header->bonustype); + else if (fastcmp(field,"levelflags")) + lua_pushinteger(L, header->levelflags); + else if (fastcmp(field,"menuflags")) + lua_pushinteger(L, header->menuflags); + // TODO add support for reading numGradedMares and grades + else { + // Read custom vars now + // (note: don't include the "LUA." in your lua scripts!) + UINT8 i = 0; + for (;i < header->numCustomOptions && !fastcmp(field, header->customopts[i].option); ++i); + + if(i < header->numCustomOptions) + lua_pushlstring(L, header->customopts[i].value, 255); + else + lua_pushnil(L); + } + return 1; +} + int LUA_MapLib(lua_State *L) { luaL_newmetatable(L, META_SECTOR); @@ -787,6 +1231,22 @@ int LUA_MapLib(lua_State *L) lua_setfield(L, -2, "__len"); lua_pop(L, 1); + luaL_newmetatable(L, META_FFLOOR); + lua_pushcfunction(L, ffloor_get); + lua_setfield(L, -2, "__index"); + + lua_pushcfunction(L, ffloor_set); + lua_setfield(L, -2, "__newindex"); + lua_pop(L, 1); + + luaL_newmetatable(L, META_MAPHEADER); + lua_pushcfunction(L, mapheaderinfo_get); + lua_setfield(L, -2, "__index"); + + //lua_pushcfunction(L, mapheaderinfo_num); + //lua_setfield(L, -2, "__len"); + lua_pop(L, 1); + lua_newuserdata(L, 0); lua_createtable(L, 0, 2); lua_pushcfunction(L, lib_getSector); @@ -836,6 +1296,16 @@ int LUA_MapLib(lua_State *L) lua_setfield(L, -2, "__len"); lua_setmetatable(L, -2); lua_setglobal(L, "vertexes"); + + lua_newuserdata(L, 0); + lua_createtable(L, 0, 2); + lua_pushcfunction(L, lib_getMapheaderinfo); + lua_setfield(L, -2, "__index"); + + lua_pushcfunction(L, lib_nummapheaders); + lua_setfield(L, -2, "__len"); + lua_setmetatable(L, -2); + lua_setglobal(L, "mapheaderinfo"); return 0; } diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index 6fb70ccfc..f455edf1f 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -395,7 +395,7 @@ static int mobj_set(lua_State *L) return UNIMPLEMENTED; case mobj_angle: mo->angle = (angle_t)luaL_checkinteger(L, 3); - if (mo->player == &players[displayplayer]) + if (mo->player == &players[consoleplayer]) localangle = mo->angle; else if (mo->player == &players[secondarydisplayplayer]) localangle2 = mo->angle; diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 20d9fb620..2686aed97 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -267,7 +267,7 @@ static int player_get(lua_State *L) else if (fastcmp(field,"drilldelay")) lua_pushinteger(L, plr->drilldelay); else if (fastcmp(field,"bonustime")) - lua_pushinteger(L, plr->bonustime); + lua_pushboolean(L, plr->bonustime); else if (fastcmp(field,"capsule")) LUA_PushUserdata(L, plr->capsule, META_MOBJ); else if (fastcmp(field,"mare")) @@ -345,14 +345,9 @@ static int player_set(lua_State *L) return luaL_error(L, "Do not alter player_t in HUD rendering code!"); if (fastcmp(field,"mo")) { - if (!lua_isnil(L, 3)) - { - plr->mo->player = NULL; - plr->mo = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)); - plr->mo->player = plr; - } - else - return luaL_error(L, "player.mo should not be nil!"); + mobj_t *newmo = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)); + plr->mo->player = NULL; // remove player pointer from old mobj + (newmo->player = plr)->mo = newmo; // set player pointer for new mobj, and set new mobj as the player's mobj } else if (fastcmp(field,"cmd")) return NOSET; @@ -368,7 +363,7 @@ static int player_set(lua_State *L) plr->bob = (fixed_t)luaL_checkinteger(L, 3); else if (fastcmp(field,"aiming")) { plr->aiming = (angle_t)luaL_checkinteger(L, 3); - if (plr == &players[displayplayer]) + if (plr == &players[consoleplayer]) localaiming = plr->aiming; else if (plr == &players[secondarydisplayplayer]) localaiming2 = plr->aiming; @@ -392,7 +387,7 @@ static int player_set(lua_State *L) else if (fastcmp(field,"flashpal")) plr->flashpal = (UINT16)luaL_checkinteger(L, 3); else if (fastcmp(field,"skincolor")) - plr->skincolor = (UINT8)luaL_checkinteger(L, 3); + plr->skincolor = ((UINT8)luaL_checkinteger(L, 3)) % MAXSKINCOLORS; else if (fastcmp(field,"score")) plr->score = (UINT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"dashspeed")) @@ -623,7 +618,7 @@ static int power_get(lua_State *L) { UINT16 *powers = *((UINT16 **)luaL_checkudata(L, 1, META_POWERS)); powertype_t p = luaL_checkinteger(L, 2); - if (p > NUMPOWERS) + if (p >= NUMPOWERS) return luaL_error(L, LUA_QL("powertype_t") " cannot be %u", p); lua_pushinteger(L, powers[p]); return 1; @@ -635,7 +630,7 @@ static int power_set(lua_State *L) UINT16 *powers = *((UINT16 **)luaL_checkudata(L, 1, META_POWERS)); powertype_t p = luaL_checkinteger(L, 2); UINT16 i = (UINT16)luaL_checkinteger(L, 3); - if (p > NUMPOWERS) + if (p >= NUMPOWERS) return luaL_error(L, LUA_QL("powertype_t") " cannot be %u", p); if (hud_running) return luaL_error(L, "Do not alter player_t in HUD rendering code!"); diff --git a/src/lua_script.c b/src/lua_script.c index 4f37c0903..b50bd0977 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -30,6 +30,8 @@ #include "lua_libs.h" #include "lua_hook.h" +#include "doomstat.h" + lua_State *gL = NULL; // List of internal libraries to load from SRB2 @@ -453,6 +455,7 @@ enum ARCH_SIDE, ARCH_SUBSECTOR, ARCH_SECTOR, + ARCH_MAPHEADER, ARCH_TEND=0xFF, }; @@ -471,6 +474,7 @@ static const struct { {META_SIDE, ARCH_SIDE}, {META_SUBSECTOR,ARCH_SUBSECTOR}, {META_SECTOR, ARCH_SECTOR}, + {META_MAPHEADER, ARCH_MAPHEADER}, {NULL, ARCH_NULL} }; @@ -665,6 +669,17 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) } break; } + case ARCH_MAPHEADER: + { + mapheader_t *header = *((mapheader_t **)lua_touserdata(gL, myindex)); + if (!header) + WRITEUINT8(save_p, ARCH_NULL); + else { + WRITEUINT8(save_p, ARCH_MAPHEADER); + WRITEUINT16(save_p, header - *mapheaderinfo); + } + break; + } default: WRITEUINT8(save_p, ARCH_NULL); return 2; @@ -835,6 +850,9 @@ static UINT8 UnArchiveValue(int TABLESINDEX) case ARCH_SECTOR: LUA_PushUserdata(gL, §ors[READUINT16(save_p)], META_SECTOR); break; + case ARCH_MAPHEADER: + LUA_PushUserdata(gL, §ors[READUINT16(save_p)], META_MAPHEADER); + break; case ARCH_TEND: return 1; } diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c index b26036308..f797f30d6 100644 --- a/src/lua_skinlib.c +++ b/src/lua_skinlib.c @@ -14,6 +14,7 @@ #ifdef HAVE_BLUA #include "fastcmp.h" #include "r_things.h" +#include "sounds.h" #include "lua_script.h" #include "lua_libs.h" @@ -182,7 +183,8 @@ static int skin_get(lua_State *L) lua_pushinteger(L, skin->highresscale); break; case skin_soundsid: - return UNIMPLEMENTED; + LUA_PushUserdata(L, skin->soundsid, META_SOUNDSID); + break; } return 1; } @@ -275,6 +277,24 @@ static int lib_numSkins(lua_State *L) return 1; } +// soundsid, i -> soundsid[i] +static int soundsid_get(lua_State *L) +{ + sfxenum_t *soundsid = *((sfxenum_t **)luaL_checkudata(L, 1, META_SOUNDSID)); + skinsound_t i = luaL_checkinteger(L, 2); + if (i >= NUMSKINSOUNDS) + return luaL_error(L, LUA_QL("skinsound_t") " cannot be %u", i); + lua_pushinteger(L, soundsid[i]); + return 1; +} + +// #soundsid -> NUMSKINSOUNDS +static int soundsid_num(lua_State *L) +{ + lua_pushinteger(L, NUMSKINSOUNDS); + return 1; +} + int LUA_SkinLib(lua_State *L) { luaL_newmetatable(L, META_SKIN); @@ -288,6 +308,14 @@ int LUA_SkinLib(lua_State *L) lua_setfield(L, -2, "__len"); lua_pop(L,1); + luaL_newmetatable(L, META_SOUNDSID); + lua_pushcfunction(L, soundsid_get); + lua_setfield(L, -2, "__index"); + + lua_pushcfunction(L, soundsid_num); + lua_setfield(L, -2, "__len"); + lua_pop(L,1); + lua_newuserdata(L, 0); lua_createtable(L, 0, 2); lua_pushcfunction(L, lib_getSkin); diff --git a/src/m_cheat.c b/src/m_cheat.c index 16bd88ad8..8cea4c6ae 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -16,6 +16,7 @@ #include "g_game.h" #include "s_sound.h" +#include "r_local.h" #include "p_local.h" #include "p_setup.h" #include "d_net.h" @@ -336,6 +337,22 @@ void Command_Hurtme_f(void) P_DamageMobj(players[consoleplayer].mo, NULL, NULL, atoi(COM_Argv(1))); } +// Moves the NiGHTS player to another axis within the current mare +void Command_JumpToAxis_f(void) +{ + REQUIRE_DEVMODE; + REQUIRE_INLEVEL; + REQUIRE_SINGLEPLAYER; + + if (COM_Argc() != 2) + { + CONS_Printf(M_GetText("jumptoaxis : Jump to axis within current mare.\n")); + return; + } + + P_TransferToAxis(&players[consoleplayer], atoi(COM_Argv(1))); +} + void Command_Charability_f(void) { REQUIRE_DEVMODE; @@ -384,6 +401,171 @@ void Command_Charspeed_f(void) CONS_Printf(M_GetText("charspeed : set character speed\n")); } +void Command_RTeleport_f(void) +{ + fixed_t intx, inty, intz; + size_t i; + player_t *p = &players[consoleplayer]; + subsector_t *ss; + + REQUIRE_DEVMODE; + REQUIRE_INLEVEL; + REQUIRE_SINGLEPLAYER; + + if (COM_Argc() < 3 || COM_Argc() > 7) + { + CONS_Printf(M_GetText("rteleport -x -y -z : relative teleport to a location\n")); + return; + } + + if (!p->mo) + return; + + i = COM_CheckParm("-x"); + if (i) + intx = atoi(COM_Argv(i + 1)); + else + intx = 0; + + i = COM_CheckParm("-y"); + if (i) + inty = atoi(COM_Argv(i + 1)); + else + inty = 0; + + ss = R_PointInSubsector(p->mo->x + intx*FRACUNIT, p->mo->y + inty*FRACUNIT); + if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height) + { + CONS_Alert(CONS_NOTICE, M_GetText("Not a valid location.\n")); + return; + } + i = COM_CheckParm("-z"); + if (i) + { + intz = atoi(COM_Argv(i + 1)); + intz <<= FRACBITS; + intz += p->mo->z; + if (intz < ss->sector->floorheight) + intz = ss->sector->floorheight; + if (intz > ss->sector->ceilingheight - p->mo->height) + intz = ss->sector->ceilingheight - p->mo->height; + } + else + intz = p->mo->z; + + CONS_Printf(M_GetText("Teleporting by %d, %d, %d...\n"), intx, inty, FixedInt((intz-p->mo->z))); + + P_MapStart(); + if (!P_TeleportMove(p->mo, p->mo->x+intx*FRACUNIT, p->mo->y+inty*FRACUNIT, intz)) + CONS_Alert(CONS_WARNING, M_GetText("Unable to teleport to that spot!\n")); + else + S_StartSound(p->mo, sfx_mixup); + P_MapEnd(); +} + +void Command_Teleport_f(void) +{ + fixed_t intx, inty, intz; + size_t i; + player_t *p = &players[consoleplayer]; + subsector_t *ss; + + REQUIRE_DEVMODE; + REQUIRE_INLEVEL; + REQUIRE_SINGLEPLAYER; + + if (COM_Argc() < 3 || COM_Argc() > 7) + { + CONS_Printf(M_GetText("teleport -x -y -z : teleport to a location\n")); + return; + } + + if (!p->mo) + return; + + i = COM_CheckParm("-x"); + if (i) + intx = atoi(COM_Argv(i + 1)); + else + { + CONS_Alert(CONS_NOTICE, M_GetText("%s value not specified\n"), "X"); + return; + } + + i = COM_CheckParm("-y"); + if (i) + inty = atoi(COM_Argv(i + 1)); + else + { + CONS_Alert(CONS_NOTICE, M_GetText("%s value not specified\n"), "Y"); + return; + } + + ss = R_PointInSubsector(intx*FRACUNIT, inty*FRACUNIT); + if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height) + { + CONS_Alert(CONS_NOTICE, M_GetText("Not a valid location.\n")); + return; + } + i = COM_CheckParm("-z"); + if (i) + { + intz = atoi(COM_Argv(i + 1)); + intz <<= FRACBITS; + if (intz < ss->sector->floorheight) + intz = ss->sector->floorheight; + if (intz > ss->sector->ceilingheight - p->mo->height) + intz = ss->sector->ceilingheight - p->mo->height; + } + else + intz = ss->sector->floorheight; + + CONS_Printf(M_GetText("Teleporting to %d, %d, %d...\n"), intx, inty, FixedInt(intz)); + + P_MapStart(); + if (!P_TeleportMove(p->mo, intx*FRACUNIT, inty*FRACUNIT, intz)) + CONS_Alert(CONS_WARNING, M_GetText("Unable to teleport to that spot!\n")); + else + S_StartSound(p->mo, sfx_mixup); + P_MapEnd(); +} + +void Command_Skynum_f(void) +{ + REQUIRE_DEVMODE; + REQUIRE_INLEVEL; + REQUIRE_SINGLEPLAYER; + + if (COM_Argc() != 2) + { + CONS_Printf(M_GetText("skynum : change the sky\n")); + CONS_Printf(M_GetText("Current sky is %d\n"), levelskynum); + return; + } + + CONS_Printf(M_GetText("Previewing sky %s...\n"), COM_Argv(1)); + + P_SetupLevelSky(atoi(COM_Argv(1)), false); +} + +void Command_Weather_f(void) +{ + REQUIRE_DEVMODE; + REQUIRE_INLEVEL; + REQUIRE_SINGLEPLAYER; + + if (COM_Argc() != 2) + { + CONS_Printf(M_GetText("weather : change the weather\n")); + CONS_Printf(M_GetText("Current weather is %d\n"), curWeather); + return; + } + + CONS_Printf(M_GetText("Previewing weather %s...\n"), COM_Argv(1)); + + P_SwitchWeather(atoi(COM_Argv(1))); +} + #ifdef _DEBUG // You never thought you needed this, did you? >=D // Yes, this has the specific purpose of completely screwing you up @@ -795,13 +977,6 @@ void OP_NightsObjectplace(player_t *player) if (!OP_HeightOkay(player, false)) return; - angle = (UINT16)((360-player->anotherflyangle) % 360); - if (angle > 90 && angle < 270) - { - angle += 180; - angle %= 360; - } - if (player->mo->target->flags & MF_AMBUSH) angle = (UINT16)player->anotherflyangle; else diff --git a/src/m_cheat.h b/src/m_cheat.h index 98001c5ec..b9c73ee18 100644 --- a/src/m_cheat.h +++ b/src/m_cheat.h @@ -57,8 +57,13 @@ void Command_Devmode_f(void); void Command_Scale_f(void); void Command_Gravflip_f(void); void Command_Hurtme_f(void); +void Command_JumpToAxis_f(void); void Command_Charability_f(void); void Command_Charspeed_f(void); +void Command_Teleport_f(void); +void Command_RTeleport_f(void); +void Command_Skynum_f(void); +void Command_Weather_f(void); #ifdef _DEBUG void Command_CauseCfail_f(void); #endif diff --git a/src/m_menu.c b/src/m_menu.c index 887ac5fcb..605096465 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1110,7 +1110,7 @@ static menuitem_t OP_VideoOptionsMenu[] = {IT_SUBMENU|IT_STRING, NULL, "3D Card Options...", &OP_OpenGLOptionsDef, 20}, #endif -#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL) +#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) {IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 30}, #endif @@ -6244,8 +6244,13 @@ static void M_DrawSetupMultiPlayerMenu(void) // draw player sprite if (!setupm_fakecolor) // should never happen but hey, who knows { - if (skins[setupm_fakeskin].flags & SF_HIRES && skins[setupm_fakeskin].highresscale == FRACUNIT>>1) - V_DrawSmallScaledPatch(mx + 98 + (PLBOXW*8/2), my + 16 + (PLBOXH*8) - 12, flags, patch); + if (skins[setupm_fakeskin].flags & SF_HIRES) + { + V_DrawSciencePatch((mx+98+(PLBOXW*8/2))<>1) - V_DrawSmallMappedPatch(mx + 98 + (PLBOXW*8/2), my + 16 + (PLBOXH*8) - 12, flags, patch, colormap); + if (skins[setupm_fakeskin].flags & SF_HIRES) + { + V_DrawFixedPatch((mx+98+(PLBOXW*8/2))<tracer->x - actor->x, actor->tracer->y - actor->y); - exact = R_PointToAngle2(actor->x, actor->z, actor->x + xydist, actor->tracer->z); + exact = R_PointToAngle2(0, 0, xydist, actor->tracer->z - actor->z); actor->movedir = exact; /*if (exact != actor->movedir) { @@ -6730,7 +6730,8 @@ void A_BuzzFly(mobj_t *actor) actor->momz = FixedMul(FixedDiv(actor->target->z - actor->z, dist), realspeed); if (actor->z+actor->momz >= actor->waterbottom && actor->watertop > actor->floorz - && actor->z+actor->momz > actor->watertop - FixedMul(256*FRACUNIT, actor->scale)) + && actor->z+actor->momz > actor->watertop - FixedMul(256*FRACUNIT, actor->scale) + && actor->z+actor->momz <= actor->watertop) { actor->momz = 0; actor->z = actor->watertop; @@ -7299,11 +7300,16 @@ void A_SpawnObjectRelative(mobj_t *actor) // void A_ChangeAngleRelative(mobj_t *actor) { + // Oh god, the old code /sucked/. Changed this and the absolute version to get a random range using amin and amax instead of + // getting a random angle from the _entire_ spectrum and then clipping. While we're at it, do the angle conversion to the result + // rather than the ranges, so <0 and >360 work as possible values. -Red INT32 locvar1 = var1; INT32 locvar2 = var2; - angle_t angle = (P_Random()+1)<<24; - const angle_t amin = FixedAngle(locvar1*FRACUNIT); - const angle_t amax = FixedAngle(locvar2*FRACUNIT); + //angle_t angle = (P_Random()+1)<<24; + const fixed_t amin = locvar1*FRACUNIT; + const fixed_t amax = locvar2*FRACUNIT; + //const angle_t amin = FixedAngle(locvar1*FRACUNIT); + //const angle_t amax = FixedAngle(locvar2*FRACUNIT); #ifdef HAVE_BLUA if (LUA_CallAction("A_ChangeAngleRelative", actor)) return; @@ -7313,13 +7319,13 @@ void A_ChangeAngleRelative(mobj_t *actor) if (amin > amax) I_Error("A_ChangeAngleRelative: var1 is greater then var2"); #endif - +/* if (angle < amin) angle = amin; if (angle > amax) - angle = amax; + angle = amax;*/ - actor->angle += angle; + actor->angle += FixedAngle(P_RandomRange(amin, amax)); } // Function: A_ChangeAngleAbsolute @@ -7333,9 +7339,11 @@ void A_ChangeAngleAbsolute(mobj_t *actor) { INT32 locvar1 = var1; INT32 locvar2 = var2; - angle_t angle = (P_Random()+1)<<24; - const angle_t amin = FixedAngle(locvar1*FRACUNIT); - const angle_t amax = FixedAngle(locvar2*FRACUNIT); + //angle_t angle = (P_Random()+1)<<24; + const fixed_t amin = locvar1*FRACUNIT; + const fixed_t amax = locvar2*FRACUNIT; + //const angle_t amin = FixedAngle(locvar1*FRACUNIT); + //const angle_t amax = FixedAngle(locvar2*FRACUNIT); #ifdef HAVE_BLUA if (LUA_CallAction("A_ChangeAngelAbsolute", actor)) return; @@ -7345,13 +7353,13 @@ void A_ChangeAngleAbsolute(mobj_t *actor) if (amin > amax) I_Error("A_ChangeAngleAbsolute: var1 is greater then var2"); #endif - +/* if (angle < amin) angle = amin; if (angle > amax) - angle = amax; + angle = amax;*/ - actor->angle = angle; + actor->angle = FixedAngle(P_RandomRange(amin, amax)); } // Function: A_PlaySound @@ -9313,9 +9321,15 @@ void A_SpikeRetract(mobj_t *actor) return; if (locvar1 == 0) + { actor->flags &= ~MF_SOLID; + actor->flags |= MF_NOCLIPTHING; + } else + { actor->flags |= MF_SOLID; + actor->flags &= ~MF_NOCLIPTHING; + } if (actor->flags & MF_SOLID) P_CheckPosition(actor, actor->x, actor->y); } diff --git a/src/p_floor.c b/src/p_floor.c index 836df06c2..6d28175eb 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -31,7 +31,7 @@ static inline boolean P_MobjReadyToMove(mobj_t *mo, sector_t *sec, boolean secto { if (sectorisquicksand) return (mo->z > sec->floorheight && mo->z < sec->ceilingheight); - else if (((mo->flags & MF_SPAWNCEILING) == MF_SPAWNCEILING) ^ ((mo->eflags & MFE_VERTICALFLIP) == MFE_VERTICALFLIP)) + else if (!!(mo->flags & MF_SPAWNCEILING) ^ !!(mo->eflags & MFE_VERTICALFLIP)) return ((sectorisffloor) ? (mo->z+mo->height != sec->floorheight) : (mo->z+mo->height != sec->ceilingheight)); else return ((sectorisffloor) ? (mo->z != sec->ceilingheight) : (mo->z != sec->floorheight)); @@ -241,7 +241,7 @@ result_e T_MovePlane(sector_t *sector, fixed_t speed, fixed_t dest, boolean crus // Is the object hang from the ceiling? // In that case, swap the planes used. // verticalflip inverts - if (((mo->flags & MF_SPAWNCEILING) == MF_SPAWNCEILING) ^ ((mo->eflags & MFE_VERTICALFLIP) == MFE_VERTICALFLIP)) + if (!!(mo->flags & MF_SPAWNCEILING) ^ !!(mo->eflags & MFE_VERTICALFLIP)) { if (sectorisffloor && !sectorisquicksand) mo->z = mo->ceilingz - mo->height; @@ -886,9 +886,8 @@ void T_BounceCheese(levelspecthink_t *bouncer) bouncer->speed += gravity; } - if (bouncer->speed < 2*FRACUNIT && bouncer->speed > -2*FRACUNIT - && bouncer->sector->ceilingheight < bouncer->ceilingwasheight + FRACUNIT/4 - && bouncer->sector->ceilingheight > bouncer->ceilingwasheight - FRACUNIT/4) + if (abs(bouncer->speed) < 2*FRACUNIT + && abs(bouncer->sector->ceilingheight-bouncer->ceilingwasheight) < FRACUNIT/4) { bouncer->sector->floorheight = bouncer->floorwasheight; bouncer->sector->ceilingheight = bouncer->ceilingwasheight; @@ -1997,7 +1996,7 @@ void T_NoEnemiesSector(levelspecthink_t *nobaddies) { thing = node->m_thing; - if (((thing->flags & MF_ENEMY) || (thing->flags & MF_BOSS)) && thing->health > 0 + if ((thing->flags & (MF_ENEMY|MF_BOSS)) && thing->health > 0 && thing->z < upperbound && thing->z+thing->height > lowerbound) { exists = true; @@ -2027,12 +2026,12 @@ foundenemy: // // Helper function for T_EachTimeThinker // -static INT32 P_HavePlayersEnteredArea(INT32 *curPlayers, INT32 *oldPlayers, boolean inAndOut) +static INT32 P_HavePlayersEnteredArea(boolean *curPlayers, boolean *oldPlayers, boolean inAndOut) { INT32 i; // Easy check... nothing has changed - if (!memcmp(curPlayers, oldPlayers, sizeof(INT32)*MAXPLAYERS)) + if (!memcmp(curPlayers, oldPlayers, sizeof(boolean)*MAXPLAYERS)) return -1; // Otherwise, we have to check if any new players have entered @@ -2061,15 +2060,15 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) size_t i, j; sector_t *sec = NULL; sector_t *targetsec = NULL; - sector_t *usesec = NULL; + //sector_t *usesec = NULL; INT32 secnum = -1; INT32 affectPlayer = 0; - INT32 oldPlayersInArea[MAXPLAYERS]; - INT32 playersInArea[MAXPLAYERS]; - INT32 oldPlayersOnArea[MAXPLAYERS]; - INT32 playersOnArea[MAXPLAYERS]; - INT32 *oldPlayersArea; - INT32 *playersArea; + boolean oldPlayersInArea[MAXPLAYERS]; + boolean playersInArea[MAXPLAYERS]; + boolean oldPlayersOnArea[MAXPLAYERS]; + boolean playersOnArea[MAXPLAYERS]; + boolean *oldPlayersArea; + boolean *playersArea; boolean FOFsector = false; boolean inAndOut = false; boolean floortouch = false; @@ -2089,14 +2088,23 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) oldPlayersOnArea[i] = eachtime->var2s[i/2] >> 16; } - playersInArea[i] = 0; - playersOnArea[i] = 0; + playersInArea[i] = false; + playersOnArea[i] = false; } while ((secnum = P_FindSectorFromLineTag(eachtime->sourceline, secnum)) >= 0) { 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++) { @@ -2111,11 +2119,6 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) { targetsec = §ors[targetsecnum]; - if (GETSECSPECIAL(targetsec->special, 2) == 3 || GETSECSPECIAL(targetsec->special, 2) == 5) - floortouch = true; - else - floortouch = false; - for (j = 0; j < MAXPLAYERS; j++) { if (!playeringame[j]) @@ -2146,7 +2149,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) else eachtime->var2s[j/2] |= 1 << 16; - playersOnArea[j] = 1; + playersOnArea[j] = true; } else { @@ -2155,7 +2158,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) else eachtime->vars[j/2] |= 1 << 16; - playersInArea[j] = 1; + playersInArea[j] = true; } } } @@ -2163,11 +2166,6 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) if (!FOFsector) { - if (GETSECSPECIAL(sec->special, 2) == 3 || GETSECSPECIAL(sec->special, 2) == 5) - floortouch = true; - else - floortouch = false; - for (i = 0; i < MAXPLAYERS; i++) { if (!playeringame[i]) @@ -2192,7 +2190,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) else eachtime->var2s[i/2] |= 1 << 16; - playersOnArea[i] = 1; + playersOnArea[i] = true; } else { @@ -2201,17 +2199,12 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) else eachtime->vars[i/2] |= 1 << 16; - playersInArea[i] = 1; + playersInArea[i] = true; } } } } - if (FOFsector && targetsec) - usesec = targetsec; - else - usesec = sec; - if ((eachtime->sourceline->flags & ML_BOUNCY) == ML_BOUNCY) inAndOut = true; @@ -2231,12 +2224,34 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) if ((affectPlayer = P_HavePlayersEnteredArea(playersArea, oldPlayersArea, inAndOut)) != -1) { + if (GETSECSPECIAL(sec->special, 2) == 2 || GETSECSPECIAL(sec->special, 2) == 3) + { + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i]) + continue; + + if (!players[i].mo) + continue; + + if (players[i].mo->health <= 0) + continue; + + if ((netgame || multiplayer) && players[i].spectator) + continue; + + if (!playersArea[i]) + return; + } + } + CONS_Debug(DBG_GAMELOGIC, "Trying to activate each time executor with tag %d\n", eachtime->sourceline->tag); - // Fake-out P_LinedefExecute into thinking you are a continuous. - eachtime->sourceline->special--; - P_LinedefExecute(eachtime->sourceline->tag, players[affectPlayer].mo, usesec); - eachtime->sourceline->special++; + // 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[affectPlayer].mo, sec); } } diff --git a/src/p_inter.c b/src/p_inter.c index c55c3cf71..f66bf12f3 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -295,9 +295,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) return; } - if (((toucher->player->pflags & PF_NIGHTSMODE) && (toucher->player->pflags & PF_DRILLING)) - || (toucher->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING)) - || toucher->player->powers[pw_invulnerability] || toucher->player->powers[pw_super]) // Do you possess the ability to subdue the object? + if (((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING)) + || (player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING)) + || player->powers[pw_invulnerability] || player->powers[pw_super]) // Do you possess the ability to subdue the object? { if (P_MobjFlip(toucher)*toucher->momz < 0) toucher->momz = -toucher->momz; @@ -307,8 +307,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } else if (((toucher->z < special->z && !(toucher->eflags & MFE_VERTICALFLIP)) || (toucher->z + toucher->height > special->z + special->height && (toucher->eflags & MFE_VERTICALFLIP))) - && toucher->player->charability == CA_FLY - && (toucher->player->powers[pw_tailsfly] + && player->charability == CA_FLY + && (player->powers[pw_tailsfly] || (toucher->state >= &states[S_PLAY_SPC1] && toucher->state <= &states[S_PLAY_SPC4]))) // Tails can shred stuff with his propeller. { toucher->momz = -toucher->momz/2; @@ -325,8 +325,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) //////////////////////////////////////////////////////// /////ENEMIES!!////////////////////////////////////////// //////////////////////////////////////////////////////// - if (special->type == MT_GSNAPPER && !(((toucher->player->pflags & PF_NIGHTSMODE) && (toucher->player->pflags & PF_DRILLING)) - || toucher->player->powers[pw_invulnerability] || toucher->player->powers[pw_super]) + if (special->type == MT_GSNAPPER && !(((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING)) + || player->powers[pw_invulnerability] || player->powers[pw_super]) && toucher->z < special->z + special->height && toucher->z + toucher->height > special->z) { // Can only hit snapper from above @@ -338,9 +338,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // Cannot hit sharp from above or when red and angry P_DamageMobj(toucher, special, special, 1); } - else if (((toucher->player->pflags & PF_NIGHTSMODE) && (toucher->player->pflags & PF_DRILLING)) - || (toucher->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING)) - || toucher->player->powers[pw_invulnerability] || toucher->player->powers[pw_super]) // Do you possess the ability to subdue the object? + else if (((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING)) + || (player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING)) + || player->powers[pw_invulnerability] || player->powers[pw_super]) // Do you possess the ability to subdue the object? { if (P_MobjFlip(toucher)*toucher->momz < 0) toucher->momz = -toucher->momz; @@ -349,8 +349,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } else if (((toucher->z < special->z && !(toucher->eflags & MFE_VERTICALFLIP)) || (toucher->z + toucher->height > special->z + special->height && (toucher->eflags & MFE_VERTICALFLIP))) // Flame is bad at logic - JTE - && toucher->player->charability == CA_FLY - && (toucher->player->powers[pw_tailsfly] + && player->charability == CA_FLY + && (player->powers[pw_tailsfly] || (toucher->state >= &states[S_PLAY_SPC1] && toucher->state <= &states[S_PLAY_SPC4]))) // Tails can shred stuff with his propeller. { if (P_MobjFlip(toucher)*toucher->momz < 0) @@ -429,7 +429,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) case MT_GRENADEPICKUP: case MT_EXPLODEPICKUP: case MT_RAILPICKUP: - if (!(P_CanPickupItem(toucher->player, true))) + if (!(P_CanPickupItem(player, true))) return; // Give the power and ringweapon @@ -453,7 +453,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) case MT_GRENADERING: case MT_EXPLOSIONRING: case MT_RAILRING: - if (!(P_CanPickupItem(toucher->player, true))) + if (!(P_CanPickupItem(player, true))) return; if (special->info->mass >= pw_infinityring && special->info->mass <= pw_railring) @@ -541,7 +541,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // Power stones / Match emeralds case MT_FLINGEMERALD: - if (!(P_CanPickupItem(toucher->player, true)) || player->tossdelay) + if (!(P_CanPickupItem(player, true)) || player->tossdelay) return; player->powers[pw_emeralds] |= special->threshold; @@ -612,10 +612,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) player->gotflag |= flagflag; CONS_Printf(M_GetText("%s picked up the %s flag!\n"), player_names[player-players], flagtext); (*flagmobj) = NULL; - player->pflags &= ~PF_GLIDING; - player->climbing = 0; - if (player->powers[pw_tailsfly]) - player->powers[pw_tailsfly] = 1; + // code for dealing with abilities is handled elsewhere now break; } } @@ -627,55 +624,46 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) case MT_NIGHTSDRONE: if (player->bot) return; - if (G_IsSpecialStage(gamemap) && player->bonustime && !player->exiting) + if (player->exiting) + return; + if (player->bonustime) { - // only allow the player with the emerald in-hand to leave. - if (player->mo->tracer && player->mo->tracer->target - && player->mo->tracer->target->type == MT_GOTEMERALD) + if (G_IsSpecialStage(gamemap)) //After-mare bonus time/emerald reward in special stages. { - P_NightserizePlayer(player, special->health); + // only allow the player with the emerald in-hand to leave. + if (toucher->tracer && toucher->tracer->target + && toucher->tracer->target->type == MT_GOTEMERALD) + { + } + else // Make sure that SOMEONE has the emerald, at least! + { + for (i = 0; i < MAXPLAYERS; i++) + if (playeringame[i] && players[i].playerstate == PST_LIVE + && players[i].mo->tracer && players[i].mo->tracer->target + && players[i].mo->tracer->target->type == MT_GOTEMERALD) + return; + // Well no one has an emerald, so exit anyway! + } P_GiveEmerald(false); // Don't play Ideya sound in special stage mode } - else // Make sure that SOMEONE has the emerald, at least! - { - for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i] && players[i].playerstate == PST_LIVE - && players[i].mo->tracer && players[i].mo->tracer->target - && players[i].mo->tracer->target->type == MT_GOTEMERALD) - return; - // Well no one has an emerald, so exit anyway! - P_NightserizePlayer(player, special->health); - P_GiveEmerald(false); - } + else + S_StartSound(toucher, special->info->activesound); } - else if (player->bonustime && !player->exiting) //After-mare bonus time/emerald reward in special stages. + else //Initial transformation. Don't allow second chances in special stages! { - if (!(player->pflags & PF_NIGHTSMODE)) - { - if (!(netgame || multiplayer)) - P_SetTarget(&special->tracer, toucher); - P_SetTarget(&toucher->tracer, P_SpawnMobj(toucher->x, toucher->y, toucher->z, MT_NIGHTSCHAR)); - } + if (player->pflags & PF_NIGHTSMODE) + return; - P_NightserizePlayer(player, special->health); - S_StartSound(toucher, special->info->activesound); - } - else if (!G_IsSpecialStage(gamemap) || !player->exiting) //Initial transformation. Don't allow second chances in special stages! - { - if (!(player->pflags & PF_NIGHTSMODE)) - { - if (!(netgame || multiplayer)) - P_SetTarget(&special->tracer, toucher); - S_StartSound(toucher, sfx_supert); - P_SetTarget(&toucher->tracer, P_SpawnMobj(toucher->x, toucher->y, toucher->z, MT_NIGHTSCHAR)); - P_NightserizePlayer(player, special->health); - } + S_StartSound(toucher, sfx_supert); } + if (!(netgame || multiplayer) && !(player->pflags & PF_NIGHTSMODE)) + P_SetTarget(&special->tracer, toucher); + P_NightserizePlayer(player, special->health); // Transform! return; case MT_NIGHTSLOOPHELPER: // One second delay - if (special->fuse < player->mo->fuse - TICRATE) + if (special->fuse < toucher->fuse - TICRATE) { thinker_t *th; mobj_t *mo2; @@ -796,10 +784,13 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) return; // make sure everything is as it should be, THEN take rings from players in special stages - if ((player->pflags & PF_NIGHTSMODE) && !(toucher->target)) + if (player->pflags & PF_NIGHTSMODE && !toucher->target) return; - if (player->mare != special->threshold) + if (player->mare != special->threshold) // wrong mare + return; + + if (special->reactiontime > 0) // capsule already has a player attacking it, ignore return; if (G_IsSpecialStage(gamemap) && !player->exiting) @@ -807,8 +798,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) for (i = 0; i < MAXPLAYERS; i++) if (playeringame[i] && (&players[i] != player) && players[i].mo->health > 1) { - player->mo->health += players[i].mo->health-1; - player->health = player->mo->health; + toucher->health += players[i].mo->health-1; + player->health = toucher->health; players[i].mo->health = 1; players[i].health = players[i].mo->health; } @@ -832,7 +823,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (player->bumpertime < TICRATE/4) { - S_StartSound(player->mo, special->info->seesound); + S_StartSound(toucher, special->info->seesound); if (player->pflags & PF_NIGHTSMODE) { player->bumpertime = TICRATE/2; @@ -848,7 +839,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) //player->mo->x = special->x; //player->mo->y = special->y; //P_SetThingPosition(player->mo); - player->mo->z = special->z+(special->height/4); + toucher->z = special->z+(special->height/4); } else // More like a spring { @@ -858,11 +849,11 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) player->bumpertime = TICRATE/2; - P_UnsetThingPosition(player->mo); - player->mo->x = special->x; - player->mo->y = special->y; - P_SetThingPosition(player->mo); - player->mo->z = special->z+(special->height/4); + P_UnsetThingPosition(toucher); + toucher->x = special->x; + toucher->y = special->y; + P_SetThingPosition(toucher); + toucher->z = special->z+(special->height/4); if (special->threshold > 0) fa = (FixedAngle(((special->threshold*30)-1)*FRACUNIT)>>ANGLETOFINESHIFT) & FINEMASK; @@ -872,19 +863,19 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) xspeed = FixedMul(FINECOSINE(fa),speed); yspeed = FixedMul(FINESINE(fa),speed); - P_InstaThrust(player->mo, special->angle, xspeed/10); - player->mo->momz = yspeed/11; + P_InstaThrust(toucher, special->angle, xspeed/10); + toucher->momz = yspeed/11; - player->mo->angle = special->angle; + toucher->angle = special->angle; if (player == &players[consoleplayer]) - localangle = player->mo->angle; + localangle = toucher->angle; else if (player == &players[secondarydisplayplayer]) - localangle2 = player->mo->angle; + localangle2 = toucher->angle; P_ResetPlayer(player); - P_SetPlayerMobjState(player->mo, S_PLAY_FALL1); + P_SetPlayerMobjState(toucher, S_PLAY_FALL1); } } return; @@ -1125,7 +1116,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) case MT_FIREFLOWER: if (player->bot) return; - toucher->player->powers[pw_shield] |= SH_FIREFLOWER; + player->powers[pw_shield] |= SH_FIREFLOWER; toucher->color = SKINCOLOR_WHITE; G_GhostAddColor(GHC_FIREFLOWER); break; @@ -1142,7 +1133,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { // blatant reuse of a variable that's normally unused in circuit if (!player->tossdelay) - S_StartSound(player->mo, sfx_lose); + S_StartSound(toucher, sfx_lose); player->tossdelay = 3; return; } @@ -1159,8 +1150,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // Save the player's time and position. player->starposttime = leveltime; - player->starpostx = player->mo->x>>FRACBITS; - player->starposty = player->mo->y>>FRACBITS; + player->starpostx = toucher->x>>FRACBITS; + player->starposty = toucher->y>>FRACBITS; player->starpostz = special->z>>FRACBITS; player->starpostangle = special->angle; player->starpostnum = special->health; @@ -1189,7 +1180,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } } - S_StartSound(player->mo, special->info->painsound); + S_StartSound(toucher, special->info->painsound); if (!(netgame && circuitmap && player != &players[consoleplayer])) P_SetMobjState(special, special->info->painstate); @@ -1242,7 +1233,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (player->pflags & PF_ITEMHANG) { - P_SetTarget(&player->mo->tracer, NULL); + P_SetTarget(&toucher->tracer, NULL); player->pflags &= ~PF_ITEMHANG; } @@ -1295,8 +1286,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) S_StartSound(toucher, special->info->painsound); return; } - else if (((toucher->player->pflags & PF_NIGHTSMODE) && (toucher->player->pflags & PF_DRILLING)) || (toucher->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING)) - || toucher->player->powers[pw_invulnerability] || toucher->player->powers[pw_super]) // Do you possess the ability to subdue the object? + else if (((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING)) || (player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING)) + || player->powers[pw_invulnerability] || player->powers[pw_super]) // Do you possess the ability to subdue the object? { // Shatter the shield! toucher->momx = -toucher->momx/2; @@ -1344,7 +1335,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { player->pflags |= PF_MACESPIN; S_StartSound(toucher, sfx_spin); - P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); + P_SetPlayerMobjState(toucher, S_PLAY_ATK1); } else player->pflags |= PF_ITEMHANG; @@ -1370,7 +1361,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (player->powers[pw_shield] || player->bot) //If One-Hit Shield { P_RemoveShield(player); - S_StartSound(player->mo, sfx_shldls); // Ba-Dum! Shield loss. + S_StartSound(toucher, sfx_shldls); // Ba-Dum! Shield loss. } else { @@ -1409,8 +1400,14 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) return; if (mariomode) return; - else if (special->z < player->mo->z + player->mo->height / 3 - || special->z > player->mo->z + (player->mo->height*2/3)) + else if (toucher->eflags & MFE_VERTICALFLIP) + { + if (special->z+special->height < toucher->z + toucher->height / 3 + || special->z+special->height > toucher->z + (toucher->height*2/3)) + return; // Only go in the mouth + } + else if (special->z < toucher->z + toucher->height / 3 + || special->z > toucher->z + (toucher->height*2/3)) return; // Only go in the mouth // Eaten by player! @@ -1422,11 +1419,11 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (!player->climbing) { - P_SetPlayerMobjState(player->mo, S_PLAY_GASP); + P_SetPlayerMobjState(toucher, S_PLAY_GASP); P_ResetPlayer(player); } - player->mo->momx = player->mo->momy = player->mo->momz = 0; + toucher->momx = toucher->momy = toucher->momz = 0; break; case MT_WATERDROP: @@ -1480,6 +1477,11 @@ static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *sour if (!netgame) return; // Presumably it's obvious what's happening in splitscreen. +#ifdef HAVE_BLUA + if (LUAh_DeathMsg(player, inflictor, source)) + return; +#endif + deadtarget = (player->health <= 0); // Target's name @@ -2188,6 +2190,19 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) target->fuse = TICRATE*2; break; + case MT_PLAYER: + target->fuse = TICRATE*3; // timer before mobj disappears from view (even if not an actual player) + target->momx = target->momy = target->momz = 0; + if (!(source && source->type == MT_NULL && source->threshold == 42)) // Don't jump up when drowning + P_SetObjectMomZ(target, 14*FRACUNIT, false); + + if (source && source->type == MT_NULL && source->threshold == 42) // drowned + S_StartSound(target, sfx_drown); + else if (source && (source->type == MT_SPIKE || (source->type == MT_NULL && source->threshold == 43))) // Spikes + S_StartSound(target, sfx_spkdth); + else + P_PlayDeathSound(target); + break; default: break; } @@ -2220,6 +2235,29 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) mo->flags2 |= MF2_OBJECTFLIP; } + if (target->type == MT_EGGMOBILE3) + { + thinker_t *th; + UINT32 i = 0; // to check how many clones we've removed + + // scan the thinkers to make sure all the old pinch dummies are gone on death + // this can happen if the boss was hurt earlier than expected + for (th = thinkercap.next; th != &thinkercap; th = th->next) + { + if (th->function.acp1 != (actionf_p1)P_MobjThinker) + continue; + + mo = (mobj_t *)th; + if (mo->type == (mobjtype_t)target->info->mass && mo->tracer == target) + { + P_RemoveMobj(mo); + i++; + } + if (i == 2) // we've already removed 2 of these, let's stop now + break; + } + } + if (target->type == MT_SPIKE && inflictor && target->info->deathstate != S_NULL) { const fixed_t x=target->x,y=target->y,z=target->z; @@ -2520,27 +2558,14 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage) // Get rid of shield player->powers[pw_shield] = SH_NONE; player->mo->color = player->skincolor; - player->mo->momx = player->mo->momy = player->mo->momz = 0; // Get rid of emeralds player->powers[pw_emeralds] = 0; - if (player->powers[pw_underwater] != 1) // Don't jump up when drowning - P_SetObjectMomZ(player->mo, 14*FRACUNIT, false); - else - P_SetObjectMomZ(player->mo, 0, false); - P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2); P_ResetPlayer(player); - if (source && source->type == MT_NULL && source->threshold == 42) // drowned - S_StartSound(player->mo, sfx_drown); - else if (source && (source->type == MT_SPIKE || (source->type == MT_NULL && source->threshold == 43))) // Spikes - S_StartSound(player->mo, sfx_spkdth); - else - P_PlayDeathSound(player->mo); - P_SetPlayerMobjState(player->mo, player->mo->info->deathstate); if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG))) { diff --git a/src/p_local.h b/src/p_local.h index 562546f70..f5c765fe6 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -128,8 +128,13 @@ boolean P_PlayerInPain(player_t *player); void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor); void P_ResetPlayer(player_t *player); boolean P_IsLocalPlayer(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); + void P_SetObjectMomZ(mobj_t *mo, fixed_t value, boolean relative); void P_RestoreMusic(player_t *player); void P_SpawnShieldOrb(player_t *player); @@ -141,8 +146,10 @@ void P_GiveEmerald(boolean spawnObj); void P_ResetScore(player_t *player); boolean P_MenuActivePause(void); +void P_DoJumpShield(player_t *player); void P_BlackOw(player_t *player); void P_ElementalFireTrail(player_t *player); + void P_DoPityCheck(player_t *player); void P_PlayerThink(player_t *player); void P_PlayerAfterThink(player_t *player); @@ -164,6 +171,9 @@ UINT8 P_FindLowestMare(void); void P_FindEmerald(void); void P_TransferToAxis(player_t *player, INT32 axisnum); boolean P_PlayerMoving(INT32 pnum); +void P_SpawnThokMobj(player_t *player); +void P_SpawnSpinMobj(player_t *player, mobjtype_t type); +void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range); void P_PlayLivesJingle(player_t *player); #define P_PlayRinglossSound(s) S_StartSound(s, (mariomode) ? sfx_mario8 : sfx_altow1 + P_RandomKey(4)); @@ -304,6 +314,8 @@ void P_RadiusAttack(mobj_t *spot, mobj_t *source, fixed_t damagedist); fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height); boolean PIT_PushableMoved(mobj_t *thing); +void P_DoSpring(mobj_t *spring, mobj_t *object); + // // P_SETUP // diff --git a/src/p_map.c b/src/p_map.c index 25727fb3d..fa8b9ed7d 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -45,7 +45,7 @@ static fixed_t preciptmbbox[4]; boolean floatok; fixed_t tmfloorz, tmceilingz; -static fixed_t tmdropoffz; +static fixed_t tmdropoffz, tmdrpoffceilz; // drop-off floor/ceiling heights mobj_t *tmfloorthing; // the thing corresponding to tmfloorz or NULL if tmfloorz is from a sector static mobj_t *tmhitthing; // the solid thing you bumped into (for collisions) @@ -105,7 +105,7 @@ boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z) // MOVEMENT ITERATOR FUNCTIONS // ========================================================================= -static void P_DoSpring(mobj_t *spring, mobj_t *object) +void P_DoSpring(mobj_t *spring, mobj_t *object) { INT32 pflags; fixed_t offx, offy; @@ -260,10 +260,9 @@ static boolean PIT_CheckThing(mobj_t *thing) // Metal Sonic destroys tiny baby objects. if (tmthing->type == MT_METALSONIC_RACE - && (thing->flags & MF_MISSILE || thing->flags & MF_ENEMY - || thing->flags & MF_BOSS || thing->type == MT_SPIKE)) + && (thing->flags & (MF_MISSILE|MF_ENEMY|MF_BOSS) || thing->type == MT_SPIKE)) { - if ((thing->flags & MF_ENEMY || thing->flags & MF_BOSS) && (thing->health <= 0 || !(thing->flags & MF_SHOOTABLE))) + if ((thing->flags & (MF_ENEMY|MF_BOSS)) && (thing->health <= 0 || !(thing->flags & MF_SHOOTABLE))) return true; blockdist = thing->radius + tmthing->radius; if (abs(thing->x - tmx) >= blockdist || abs(thing->y - tmy) >= blockdist) @@ -538,7 +537,7 @@ static boolean PIT_CheckThing(mobj_t *thing) return false; } - if ((thing->flags & MF_PUSHABLE) && (tmthing->player || tmthing->flags & MF_PUSHABLE) + if (thing->flags & MF_PUSHABLE && (tmthing->player || tmthing->flags & MF_PUSHABLE) && tmthing->z + tmthing->height > thing->z && tmthing->z < thing->z + thing->height && !(netgame && tmthing->player && tmthing->player->spectator)) // Push thing! { @@ -636,19 +635,19 @@ static boolean PIT_CheckThing(mobj_t *thing) // Sprite Spikes! // Do not return because solidity code comes below. - if (tmthing->type == MT_SPIKE && thing->player) // moving spike rams into player?! + if (tmthing->type == MT_SPIKE && tmthing->flags & MF_SOLID && thing->player) // moving spike rams into player?! { if (tmthing->eflags & MFE_VERTICALFLIP) { if (thing->z + thing->height <= tmthing->z + FixedMul(FRACUNIT, tmthing->scale) - && thing->z + thing->height >= tmthing->z + FixedMul(FRACUNIT, tmthing->scale) + tmthing->momz) + && thing->z + thing->height + thing->momz >= tmthing->z + FixedMul(FRACUNIT, tmthing->scale) + tmthing->momz) P_DamageMobj(thing, tmthing, tmthing, 1); } else if (thing->z >= tmthing->z + tmthing->height - FixedMul(FRACUNIT, tmthing->scale) && thing->z + thing->momz <= tmthing->z + tmthing->height - FixedMul(FRACUNIT, tmthing->scale) + tmthing->momz) P_DamageMobj(thing, tmthing, tmthing, 1); } - else if (thing->type == MT_SPIKE && tmthing->player) // unfortunate player falls into spike?! + else if (thing->type == MT_SPIKE && thing->flags & MF_SOLID && tmthing->player) // unfortunate player falls into spike?! { if (thing->eflags & MFE_VERTICALFLIP) { @@ -815,6 +814,10 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->player->pflags & PF_NIGHTSMODE) return true; + if (thing->tracer && thing->tracer->type == MT_TUBEWAYPOINT + && !(thing->player->pflags & PF_ROPEHANG)) + return true; // don't steal players from zoomtubes! + if ((thing->eflags & MFE_VERTICALFLIP) != (tmthing->eflags & MFE_VERTICALFLIP)) return true; // Both should be in same gravity @@ -887,7 +890,7 @@ static boolean PIT_CheckThing(mobj_t *thing) && P_IsObjectOnGround(thing) && (tmthing->flags & MF_SOLID)) { - if ((tmthing->flags & MF_MONITOR) || (tmthing->flags & MF_PUSHABLE)) + if (tmthing->flags & (MF_MONITOR|MF_PUSHABLE)) { if (thing != tmthing->target) P_DamageMobj(thing, tmthing, tmthing->target, 10000); @@ -940,7 +943,7 @@ static boolean PIT_CheckThing(mobj_t *thing) && P_IsObjectOnGround(thing) && (tmthing->flags & MF_SOLID)) { - if ((tmthing->flags & MF_MONITOR) || (tmthing->flags & MF_PUSHABLE)) + if (tmthing->flags & (MF_MONITOR|MF_PUSHABLE)) { if (thing != tmthing->target) P_DamageMobj(thing, tmthing, tmthing->target, 10000); @@ -1071,39 +1074,29 @@ static boolean PIT_CheckThing(mobj_t *thing) else if (thing->flags & MF_MONITOR && tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING)) { - boolean flip = (thing->eflags & MFE_VERTICALFLIP) != 0; // Save this flag in case monitor gets removed. + SINT8 flipval = P_MobjFlip(thing); // Save this value in case monitor gets removed. fixed_t *momz = &tmthing->momz; // tmthing gets changed by P_DamageMobj, so we need a new pointer?! X_x;; P_DamageMobj(thing, tmthing, tmthing, 1); // break the monitor // Going down? Then bounce back up. if ((P_MobjWasRemoved(thing) // Monitor was removed || !thing->health) // or otherwise popped - && ((!flip && *momz < 0) // monitor is on the floor and you're going down - || (flip && *momz > 0))) // or on the ceiling and you're going up + && (flipval*(*momz) < 0)) // monitor is on the floor and you're going down, or on the ceiling and you're going up *momz = -*momz; // Therefore, you should be thrust in the opposite direction, vertically. return false; } - else if (thing->flags & MF_BOSS - && ((tmthing->player->pflags & PF_JUMPED) || (tmthing->player->pflags & PF_SPINNING) - || tmthing->player->powers[pw_invulnerability] - || tmthing->player->powers[pw_super])) - { - // Going down? Then bounce back up. - if (abs(tmthing->momz) > 0) - tmthing->momz = -tmthing->momz; - - // Also, bounce back. - tmthing->momx = -tmthing->momx; - tmthing->momy = -tmthing->momy; - P_DamageMobj(thing, tmthing, tmthing, 1); // fight the boss! - return false; - } } } + + // Monitors are not treated as solid to players who are jumping, spinning or gliding, + // unless it's a CTF team monitor and you're on the wrong team + if (thing->flags & MF_MONITOR && tmthing->player && tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING) + && !((thing->type == MT_REDRINGBOX && tmthing->player->ctfteam != 1) || (thing->type == MT_BLUERINGBOX && tmthing->player->ctfteam != 2))) + ; // z checking at last // Treat noclip things as non-solid! - if ((thing->flags & MF_SOLID) && (tmthing->flags & MF_SOLID) && - !(thing->flags & MF_NOCLIP) && !(tmthing->flags & MF_NOCLIP)) + else if ((thing->flags & (MF_SOLID|MF_NOCLIP)) == MF_SOLID + && (tmthing->flags & (MF_SOLID|MF_NOCLIP)) == MF_SOLID) { if (tmthing->eflags & MFE_VERTICALFLIP) { @@ -1128,7 +1121,9 @@ static boolean PIT_CheckThing(mobj_t *thing) && tmthing->z + tmthing->height < tmthing->ceilingz) return false; // block while in air - if (topz < tmceilingz && !(thing->flags & MF_SPRING)) + if (thing->flags & MF_SPRING) + ; + else if (topz < tmceilingz && tmthing->z+tmthing->height <= thing->z+thing->height) { tmceilingz = topz; tmfloorthing = thing; // thing we may stand on @@ -1156,7 +1151,9 @@ static boolean PIT_CheckThing(mobj_t *thing) if (tmthing->player && tmthing->z < topz && tmthing->z > tmthing->floorz) return false; // block while in air - if (topz > tmfloorz && !(thing->flags & MF_SPRING)) + if (thing->flags & MF_SPRING) + ; + else if (topz > tmfloorz && tmthing->z >= thing->z) { tmfloorz = topz; tmfloorthing = thing; // thing we may stand on @@ -1219,6 +1216,9 @@ static boolean PIT_CheckCameraLine(line_t *ld) tmfloorz = openbottom; } + if (highceiling > tmdrpoffceilz) + tmdrpoffceilz = highceiling; + if (lowfloor < tmdropoffz) tmdropoffz = lowfloor; @@ -1266,7 +1266,7 @@ static boolean PIT_CheckLine(line_t *ld) { if (ld->flags & ML_IMPASSIBLE) // block objects from moving through this linedef. return false; - if (((tmthing->flags & MF_ENEMY) || (tmthing->flags & MF_BOSS)) && ld->flags & ML_BLOCKMONSTERS) + if ((tmthing->flags & (MF_ENEMY|MF_BOSS)) && ld->flags & ML_BLOCKMONSTERS) return false; // block monsters only } @@ -1285,6 +1285,9 @@ static boolean PIT_CheckLine(line_t *ld) tmfloorz = openbottom; } + if (highceiling > tmdrpoffceilz) + tmdrpoffceilz = highceiling; + if (lowfloor < tmdropoffz) tmdropoffz = lowfloor; @@ -1314,6 +1317,7 @@ static boolean PIT_CheckLine(line_t *ld) // tmfloorz // tmceilingz // tmdropoffz +// tmdrpoffceilz // the lowest point contacted // (monsters won't move to a dropoff) // speciallines[] @@ -1356,7 +1360,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) // Any contacted lines the step closer together // will adjust them. tmfloorz = tmdropoffz = newsubsec->sector->floorheight; - tmceilingz = newsubsec->sector->ceilingheight; + tmceilingz = tmdrpoffceilz = newsubsec->sector->ceilingheight; // Check list of fake floors and see if tmfloorz/tmceilingz need to be altered. if (newsubsec->sector->ffloors) @@ -1427,16 +1431,15 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) + ((*rover->topheight - *rover->bottomheight)/2)); if (*rover->topheight > tmfloorz && abs(delta1) < abs(delta2) - && (!(rover->flags & FF_REVERSEPLATFORM))) + && !(rover->flags & FF_REVERSEPLATFORM)) { tmfloorz = tmdropoffz = *rover->topheight; } if (*rover->bottomheight < tmceilingz && abs(delta1) >= abs(delta2) - && (/*thing->z + thing->height <= *rover->bottomheight - || */!(rover->flags & FF_PLATFORM)) + && !(rover->flags & FF_PLATFORM) && !(thing->type == MT_SKIM && (rover->flags & FF_SWIMMABLE))) { - tmceilingz = *rover->bottomheight; + tmceilingz = tmdrpoffceilz = *rover->bottomheight; } } } @@ -1506,7 +1509,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) tmfloorz = tmdropoffz = polytop; if (polybottom < tmceilingz && abs(delta1) >= abs(delta2)) - tmceilingz = polybottom; + tmceilingz = tmdrpoffceilz = polybottom; } plink = (polymaplink_t *)(plink->link.next); } @@ -1609,7 +1612,7 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam) if (GETSECSPECIAL(newsubsec->sector->special, 4) == 12) { // Camera noclip on entire sector. tmfloorz = tmdropoffz = thiscam->z; - tmceilingz = thiscam->z + thiscam->height; + tmceilingz = tmdrpoffceilz = thiscam->z + thiscam->height; return true; } @@ -1618,14 +1621,21 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam) // Any contacted lines the step closer together // will adjust them. tmfloorz = tmdropoffz = newsubsec->sector->floorheight; - tmceilingz = newsubsec->sector->ceilingheight; + tmceilingz = tmdrpoffceilz = newsubsec->sector->ceilingheight; // Cameras use the heightsec's heights rather then the actual sector heights. // If you can see through it, why not move the camera through it too? if (newsubsec->sector->heightsec >= 0) { tmfloorz = tmdropoffz = sectors[newsubsec->sector->heightsec].floorheight; - tmceilingz = sectors[newsubsec->sector->heightsec].ceilingheight; + tmceilingz = tmdrpoffceilz = sectors[newsubsec->sector->heightsec].ceilingheight; + } + + // Use preset camera clipping heights if set with Sector Special Parameters whose control sector has Camera Intangible special -Red + if (newsubsec->sector->camsec >= 0) + { + tmfloorz = tmdropoffz = sectors[newsubsec->sector->camsec].floorheight; + tmceilingz = tmdrpoffceilz = sectors[newsubsec->sector->camsec].ceilingheight; } // Check list of fake floors and see if tmfloorz/tmceilingz need to be altered. @@ -1650,7 +1660,7 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam) } if (*rover->bottomheight < tmceilingz && abs(delta1) >= abs(delta2)) { - tmceilingz = *rover->bottomheight; + tmceilingz = tmdrpoffceilz = *rover->bottomheight; } } } @@ -1725,7 +1735,7 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam) tmfloorz = tmdropoffz = polytop; if (polybottom < tmceilingz && abs(delta1) >= abs(delta2)) - tmceilingz = polybottom; + tmceilingz = tmdrpoffceilz = polybottom; } plink = (polymaplink_t *)(plink->link.next); } @@ -1930,11 +1940,13 @@ boolean PIT_PushableMoved(mobj_t *thing) P_SetTarget(&tmthing, oldthing); ceilingline = oldceilline; blockingline = oldblockline; + thing->momz = stand->momz; } else { thing->momx = stand->momx; thing->momy = stand->momy; + thing->momz = stand->momz; } return true; } @@ -1948,6 +1960,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) fixed_t tryx = thing->x; fixed_t tryy = thing->y; fixed_t radius = thing->radius; + fixed_t thingtop = thing->z + thing->height; floatok = false; if (radius < MAXRADIUS/2) @@ -1986,6 +1999,11 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) 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) + maxstep <<= 1; + // Don't 'step up' while springing, // Only step up "if needed". if (thing->state == &states[S_PLAY_SPRING] @@ -2014,27 +2032,22 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) return false; // mobj must raise itself to fit } } - else if (tmceilingz - thing->z < thing->height) + else if (tmceilingz < thingtop) { CheckMissileImpact(thing); return false; // mobj must lower itself to fit } - // If using type Section1:13, double the maxstep. - if (thing->player && (P_PlayerTouchingSectorSpecial(thing->player, 1, 13) - || GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 13)) - maxstep <<= 1; - // Ramp test - if (thing->player && !P_PlayerTouchingSectorSpecial(thing->player, 1, 14) - && GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) != 14) + if (thing->player && maxstep > 0 + && !(P_PlayerTouchingSectorSpecial(thing->player, 1, 14) || GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 14)) { // If the floor difference is MAXSTEPMOVE or less, and the sector isn't Section1:14, ALWAYS // step down! Formerly required a Section1:13 sector for the full MAXSTEPMOVE, but no more. if (thing->eflags & MFE_VERTICALFLIP) { - if (thing->z+thing->height == thing->ceilingz && tmceilingz > thing->z+thing->height && tmceilingz - thing->z+thing->height <= maxstep) + if (thingtop == thing->ceilingz && tmceilingz > thingtop && tmceilingz - thingtop <= maxstep) { thing->z = tmceilingz - thing->height; thing->eflags |= MFE_JUSTSTEPPEDDOWN; @@ -2049,9 +2062,11 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (thing->eflags & MFE_VERTICALFLIP) { - if (thing->z + thing->height > tmceilingz + maxstep) + if (thingtop - tmceilingz > maxstep) { CheckMissileImpact(thing); + if (tmfloorthing) + tmhitthing = tmfloorthing; return false; // too big a step up } } @@ -2065,14 +2080,20 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (tmfloorz > thing->z) { - if ((thing->flags & MF_MISSILE)) + if (thing->flags & MF_MISSILE) CheckMissileImpact(thing); } - if (!allowdropoff) - if (!(thing->flags & MF_FLOAT) && thing->type != MT_SKIM && !tmfloorthing - && tmfloorz - tmdropoffz > maxstep) + if (!allowdropoff && !(thing->flags & MF_FLOAT) && thing->type != MT_SKIM && !tmfloorthing) + { + if (thing->eflags & MFE_VERTICALFLIP) + { + if (tmdrpoffceilz - tmceilingz > maxstep) + return false; + } + else if (tmfloorz - tmdropoffz > maxstep) return false; // don't stand over a dropoff + } } } while (tryx != x || tryy != y); @@ -2562,7 +2583,7 @@ static boolean PTR_SlideTraverse(intercept_t *in) if (li->flags & ML_IMPASSIBLE) goto isblocking; - if (((slidemo->flags & MF_ENEMY) || (slidemo->flags & MF_BOSS)) && li->flags & ML_BLOCKMONSTERS) + if ((slidemo->flags & (MF_ENEMY|MF_BOSS)) && li->flags & ML_BLOCKMONSTERS) goto isblocking; } @@ -2804,7 +2825,7 @@ void P_SlideMove(mobj_t *mo) INT16 hitcount = 0; boolean success = false; - if (tmhitthing) + if (tmhitthing && mo->z + mo->height > tmhitthing->z && mo->z < tmhitthing->z + tmhitthing->height) { // Don't mess with your momentum if it's a pushable object. Pushables do their own crazy things already. if (tmhitthing->flags & MF_PUSHABLE) @@ -3205,24 +3226,34 @@ static boolean nofit; // static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush) { + mobj_t *killer = NULL; + if (P_ThingHeightClip(thing)) { - // keep checking + //thing fits, check next thing return true; } if (!(thing->flags & (MF_SHOOTABLE|MF_PUSHABLE)) || thing->flags & MF_NOCLIPHEIGHT) { - // assume it is bloody gibs or something + //doesn't interact with the crusher, just ignore it return true; } - // Crush the thing if necessary, and if it's a crumbling FOF that did it, - // reward the player who made it crumble! + // Thing doesn't fit. If thing is vulnerable, that means it's being crushed. If thing is pushable, it might + // just be blocked by another object - check if it's really a ceiling! if (thing->z + thing->height > thing->ceilingz && thing->z <= thing->ceilingz) { - if (realcrush && thing->subsector->sector->ffloors) + if (thing->flags & MF_PUSHABLE && thing->z + thing->height > thing->subsector->sector->ceilingheight) + { + //Thing is a pushable and blocks the moving ceiling + nofit = true; + return false; + } + + //Check FOFs in the sector + if (thing->subsector->sector->ffloors && (realcrush || thing->flags & MF_PUSHABLE)) { ffloor_t *rover; fixed_t delta1, delta2; @@ -3238,50 +3269,53 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush) delta2 = thingtop - (*rover->bottomheight + *rover->topheight)/2; if (*rover->bottomheight <= thing->ceilingz && abs(delta1) >= abs(delta2)) { - thinker_t *think; - elevator_t *crumbler; - - for (think = thinkercap.next; think != &thinkercap; think = think->next) + if (thing->flags & MF_PUSHABLE) { - if (think->function.acp1 != (actionf_p1)T_StartCrumble) - continue; + //FOF is blocked by pushable + nofit = true; + return false; + } + else + { + //If the thing was crushed by a crumbling FOF, reward the player who made it crumble! + thinker_t *think; + elevator_t *crumbler; - crumbler = (elevator_t *)think; - - if (crumbler->player && crumbler->player->mo - && crumbler->player->mo != thing - && crumbler->actionsector == thing->subsector->sector - && crumbler->sector == rover->master->frontsector - && (crumbler->type == elevateBounce - || crumbler->type == elevateContinuous)) + for (think = thinkercap.next; think != &thinkercap; think = think->next) { - if (netgame && thing->player && thing->player->spectator) - P_DamageMobj(thing, NULL, NULL, 42000); // Respawn crushed spectators - else - P_DamageMobj(thing, crumbler->player->mo, crumbler->player->mo, 10000); - return true; + if (think->function.acp1 != (actionf_p1)T_StartCrumble) + continue; + + crumbler = (elevator_t *)think; + + if (crumbler->player && crumbler->player->mo + && crumbler->player->mo != thing + && crumbler->actionsector == thing->subsector->sector + && crumbler->sector == rover->master->frontsector + && (crumbler->type == elevateBounce + || crumbler->type == elevateContinuous)) + { + killer = crumbler->player->mo; + } } } } } } - if (thing->flags & MF_PUSHABLE) - { - nofit = true; - return false; - } - if (realcrush) { - // Instant-death, but no one to blame + // Crush the object if (netgame && thing->player && thing->player->spectator) P_DamageMobj(thing, NULL, NULL, 42000); // Respawn crushed spectators else { - // So give a generic crush death message - mobj_t *killer = P_SpawnMobj(thing->x, thing->y, thing->z, MT_NULL); - killer->threshold = 44; // Special flag for crushing + if (!killer) + { + //Nobody is responsible for crushing the object, so give a generic crush message + killer = P_SpawnMobj(thing->x, thing->y, thing->z, MT_NULL); + killer->threshold = 44; // Special flag for crushing + } P_DamageMobj(thing, killer, killer, 10000); } } diff --git a/src/p_maputl.c b/src/p_maputl.c index a01b07371..d46080abb 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -91,6 +91,71 @@ void P_ClosestPointOnLine(fixed_t x, fixed_t y, line_t *line, vertex_t *result) return; } +// +// P_ClosestPointOnLine3D +// Finds the closest point on a given line to the supplied point IN 3D!!! +// +void P_ClosestPointOnLine3D(fixed_t x, fixed_t y, fixed_t z, line_t *line, vertex_t *result) +{ + fixed_t startx = line->v1->x; + fixed_t starty = line->v1->y; + fixed_t startz = line->v1->z; + fixed_t dx = line->dx; + fixed_t dy = line->dy; + fixed_t dz = line->v2->z - line->v1->z; + + // Determine t (the length of the vector from �Line[0]� to �p�) + fixed_t cx, cy, cz; + fixed_t vx, vy, vz; + fixed_t magnitude; + fixed_t t; + + //Sub (p, &Line[0], &c); + cx = x - startx; + cy = y - starty; + cz = z - startz; + + //Sub (&Line[1], &Line[0], &V); + vx = dx; + vy = dy; + vz = dz; + + //Normalize (&V, &V); + magnitude = R_PointToDist2(0, line->v2->z, R_PointToDist2(line->v2->x, line->v2->y, startx, starty), startz); + vx = FixedDiv(vx, magnitude); + vy = FixedDiv(vy, magnitude); + vz = FixedDiv(vz, magnitude); + + t = (FixedMul(vx, cx) + FixedMul(vy, cy) + FixedMul(vz, cz)); + + // Set closest point to the end if it extends past -Red + if (t <= 0) + { + result->x = line->v1->x; + result->y = line->v1->y; + result->z = line->v1->z; + return; + } + else if (t >= magnitude) + { + result->x = line->v2->x; + result->y = line->v2->y; + result->z = line->v2->z; + return; + } + + // Return the point between �Line[0]� and �Line[1]� + vx = FixedMul(vx, t); + vy = FixedMul(vy, t); + vz = FixedMul(vz, t); + + //Add (&Line[0], &V, out); + result->x = startx + vx; + result->y = starty + vy; + result->z = startz + vz; + return; +} + // // P_PointOnLineSide // Returns 0 or 1 @@ -255,7 +320,7 @@ fixed_t P_InterceptVector(divline_t *v2, divline_t *v1) // Sets opentop and openbottom to the window through a two sided line. // OPTIMIZE: keep this precalculated // -fixed_t opentop, openbottom, openrange, lowfloor; +fixed_t opentop, openbottom, openrange, lowfloor, highceiling; // P_CameraLineOpening // P_LineOpening, but for camera @@ -278,7 +343,12 @@ void P_CameraLineOpening(line_t *linedef) // Cameras use the heightsec's heights rather then the actual sector heights. // If you can see through it, why not move the camera through it too? - if (front->heightsec >= 0) + if (front->camsec >= 0) + { + frontfloor = sectors[front->camsec].floorheight; + frontceiling = sectors[front->camsec].ceilingheight; + } + else if (front->heightsec >= 0) { frontfloor = sectors[front->heightsec].floorheight; frontceiling = sectors[front->heightsec].ceilingheight; @@ -288,7 +358,12 @@ void P_CameraLineOpening(line_t *linedef) frontfloor = front->floorheight; frontceiling = front->ceilingheight; } - if (back->heightsec >= 0) + if (back->camsec >= 0) + { + backfloor = sectors[back->camsec].floorheight; + backceiling = sectors[back->camsec].ceilingheight; + } + else if (back->heightsec >= 0) { backfloor = sectors[back->heightsec].floorheight; backceiling = sectors[back->heightsec].ceilingheight; @@ -303,9 +378,15 @@ void P_CameraLineOpening(line_t *linedef) fixed_t thingtop = mapcampointer->z + mapcampointer->height; if (frontceiling < backceiling) + { opentop = frontceiling; + highceiling = backceiling; + } else + { opentop = backceiling; + highceiling = frontceiling; + } if (frontfloor > backfloor) { @@ -322,13 +403,12 @@ void P_CameraLineOpening(line_t *linedef) if (front->ffloors || back->ffloors) { ffloor_t *rover; + fixed_t highestceiling = highceiling; fixed_t lowestceiling = opentop; fixed_t highestfloor = openbottom; fixed_t lowestfloor = lowfloor; fixed_t delta1, delta2; - thingtop = mapcampointer->z + mapcampointer->height; - // Check for frontsector's fake floors if (front->ffloors) for (rover = front->ffloors; rover; rover = rover->next) @@ -340,6 +420,8 @@ void P_CameraLineOpening(line_t *linedef) delta2 = abs(thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); if (*rover->bottomheight < lowestceiling && delta1 >= delta2) lowestceiling = *rover->bottomheight; + else if (*rover->bottomheight < highestceiling && delta1 >= delta2) + highestceiling = *rover->bottomheight; if (*rover->topheight > highestfloor && delta1 < delta2) highestfloor = *rover->topheight; @@ -358,6 +440,8 @@ void P_CameraLineOpening(line_t *linedef) delta2 = abs(thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); if (*rover->bottomheight < lowestceiling && delta1 >= delta2) lowestceiling = *rover->bottomheight; + else if (*rover->bottomheight < highestceiling && delta1 >= delta2) + highestceiling = *rover->bottomheight; if (*rover->topheight > highestfloor && delta1 < delta2) highestfloor = *rover->topheight; @@ -365,6 +449,9 @@ void P_CameraLineOpening(line_t *linedef) lowestfloor = *rover->topheight; } + if (highestceiling < highceiling) + highceiling = highestceiling; + if (highestfloor > openbottom) openbottom = highestfloor; @@ -407,131 +494,16 @@ void P_LineOpening(line_t *linedef) I_Assert(front != NULL); I_Assert(back != NULL); - if (tmthing) - { - fixed_t thingtop = tmthing->z + tmthing->height; - - if (front->ceilingheight < back->ceilingheight) - opentop = front->ceilingheight; - else - opentop = back->ceilingheight; - - if (front->floorheight > back->floorheight) - { - openbottom = front->floorheight; - lowfloor = back->floorheight; - } - else - { - openbottom = back->floorheight; - lowfloor = front->floorheight; - } - - // Check for fake floors in the sector. - if (front->ffloors || back->ffloors -#ifdef POLYOBJECTS - || linedef->polyobj -#endif - ) - { - ffloor_t *rover; - - fixed_t lowestceiling = opentop; - fixed_t highestfloor = openbottom; - fixed_t lowestfloor = lowfloor; - fixed_t delta1; - fixed_t delta2; - - if (!tmthing) - goto no_thing; - - thingtop = tmthing->z + tmthing->height; - - // Check for frontsector's fake floors - for (rover = front->ffloors; rover; rover = rover->next) - { - if (!(rover->flags & FF_EXISTS) || !(((rover->flags & FF_BLOCKPLAYER) && tmthing->player) - || ((rover->flags & FF_BLOCKOTHERS) && !tmthing->player))) continue; - - delta1 = abs(tmthing->z - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); - delta2 = abs(thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); - if (*rover->bottomheight < lowestceiling && delta1 >= delta2) - { - if (!(rover->flags & FF_PLATFORM)) - lowestceiling = *rover->bottomheight; - } - if (*rover->topheight < highestfloor && delta1 >= delta2) - { - if (!(rover->flags & FF_REVERSEPLATFORM)) - lowestceiling = *rover->topheight; - } - - if (*rover->topheight > highestfloor && delta1 < delta2) - highestfloor = *rover->topheight; - else if (*rover->topheight > lowestfloor && delta1 < delta2) - lowestfloor = *rover->topheight; - } - - // Check for backsectors fake floors - for (rover = back->ffloors; rover; rover = rover->next) - { - if (!(rover->flags & FF_EXISTS) || !(((rover->flags & FF_BLOCKPLAYER) && tmthing->player) - || ((rover->flags & FF_BLOCKOTHERS) && !tmthing->player))) continue; - - delta1 = abs(tmthing->z - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); - delta2 = abs(thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); - if (*rover->bottomheight < lowestceiling && delta1 >= delta2) - { - if (!(rover->flags & FF_PLATFORM)) - lowestceiling = *rover->bottomheight; - } - if (*rover->topheight < highestfloor && delta1 >= delta2) - { - if (!(rover->flags & FF_REVERSEPLATFORM)) - lowestceiling = *rover->topheight; - } - - if (*rover->topheight > highestfloor && delta1 < delta2) - highestfloor = *rover->topheight; - else if (*rover->topheight > lowestfloor && delta1 < delta2) - lowestfloor = *rover->topheight; - } - -#ifdef POLYOBJECTS - // Treat polyobj's backsector like a 3D Floor - if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT)) - { - const sector_t *polysec = linedef->backsector; - - delta1 = abs(tmthing->z - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2))); - delta2 = abs(thingtop - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2))); - if (polysec->floorheight < lowestceiling && delta1 >= delta2) - lowestceiling = polysec->floorheight; - - if (polysec->ceilingheight > highestfloor && delta1 < delta2) - highestfloor = polysec->ceilingheight; - else if (polysec->ceilingheight > lowestfloor && delta1 < delta2) - lowestfloor = polysec->ceilingheight; - } -#endif - - if (highestfloor > openbottom) - openbottom = highestfloor; - - if (lowestceiling < opentop) - opentop = lowestceiling; - - if (lowestfloor > lowfloor) - lowfloor = lowestfloor; - } - openrange = opentop - openbottom; - return; - } - if (front->ceilingheight < back->ceilingheight) + { opentop = front->ceilingheight; + highceiling = back->ceilingheight; + } else + { opentop = back->ceilingheight; + highceiling = front->ceilingheight; + } if (front->floorheight > back->floorheight) { @@ -544,7 +516,109 @@ void P_LineOpening(line_t *linedef) lowfloor = front->floorheight; } -no_thing: + if (tmthing) + { + fixed_t thingtop = tmthing->z + tmthing->height; + + // Check for fake floors in the sector. + if (front->ffloors || back->ffloors +#ifdef POLYOBJECTS + || linedef->polyobj +#endif + ) + { + ffloor_t *rover; + + fixed_t highestceiling = highceiling; + fixed_t lowestceiling = opentop; + fixed_t highestfloor = openbottom; + fixed_t lowestfloor = lowfloor; + fixed_t delta1, delta2; + + // Check for frontsector's fake floors + for (rover = front->ffloors; rover; rover = rover->next) + { + if (!(rover->flags & FF_EXISTS) || !(((rover->flags & FF_BLOCKPLAYER) && tmthing->player) + || ((rover->flags & FF_BLOCKOTHERS) && !tmthing->player))) continue; + + delta1 = abs(tmthing->z - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); + delta2 = abs(thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); + + if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF + { + if (*rover->bottomheight < lowestceiling) + lowestceiling = *rover->bottomheight; + else if (*rover->bottomheight < highestceiling) + highestceiling = *rover->bottomheight; + } + + if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF + { + if (*rover->topheight > highestfloor) + highestfloor = *rover->topheight; + else if (*rover->topheight > lowestfloor) + lowestfloor = *rover->topheight; + } + } + + // Check for backsectors fake floors + for (rover = back->ffloors; rover; rover = rover->next) + { + if (!(rover->flags & FF_EXISTS) || !(((rover->flags & FF_BLOCKPLAYER) && tmthing->player) + || ((rover->flags & FF_BLOCKOTHERS) && !tmthing->player))) continue; + + delta1 = abs(tmthing->z - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); + delta2 = abs(thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); + + if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF + { + if (*rover->bottomheight < lowestceiling) + lowestceiling = *rover->bottomheight; + else if (*rover->bottomheight < highestceiling) + highestceiling = *rover->bottomheight; + } + + if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF + { + if (*rover->topheight > highestfloor) + highestfloor = *rover->topheight; + else if (*rover->topheight > lowestfloor) + lowestfloor = *rover->topheight; + } + } + +#ifdef POLYOBJECTS + // Treat polyobj's backsector like a 3D Floor + if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT)) + { + const sector_t *polysec = linedef->backsector; + + delta1 = abs(tmthing->z - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2))); + delta2 = abs(thingtop - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2))); + if (polysec->floorheight < lowestceiling && delta1 >= delta2) + lowestceiling = polysec->floorheight; + else if (polysec->floorheight < highestceiling && delta1 >= delta2) + highestceiling = polysec->floorheight; + + if (polysec->ceilingheight > highestfloor && delta1 < delta2) + highestfloor = polysec->ceilingheight; + else if (polysec->ceilingheight > lowestfloor && delta1 < delta2) + lowestfloor = polysec->ceilingheight; + } +#endif + if (highestceiling < highceiling) + highceiling = highestceiling; + + if (highestfloor > openbottom) + openbottom = highestfloor; + + if (lowestceiling < opentop) + opentop = lowestceiling; + + if (lowestfloor > lowfloor) + lowfloor = lowestfloor; + } + } openrange = opentop - openbottom; } @@ -704,11 +778,15 @@ void P_SetThingPosition(mobj_t *thing) // Allows you to 'step' on a new linedef exec when the previous // sector's floor is the same height. - if (thing->player && oldsec != NULL && thing->subsector - && oldsec != thing->subsector->sector - && thing->z <= thing->subsector->sector->floorheight) + if (thing->player && oldsec != NULL && thing->subsector && oldsec != thing->subsector->sector) { - thing->eflags |= MFE_JUSTSTEPPEDDOWN; + if (thing->eflags & MFE_VERTICALFLIP) + { + if (thing->z + thing->height >= thing->subsector->sector->ceilingheight) + thing->eflags |= MFE_JUSTSTEPPEDDOWN; + } + else if (thing->z <= thing->subsector->sector->floorheight) + thing->eflags |= MFE_JUSTSTEPPEDDOWN; } } diff --git a/src/p_maputl.h b/src/p_maputl.h index 4fa71d14e..66f7db2db 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -43,6 +43,7 @@ boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2, FUNCMATH fixed_t P_AproxDistance(fixed_t dx, fixed_t dy); void P_ClosestPointOnLine(fixed_t x, fixed_t y, line_t *line, vertex_t *result); +void P_ClosestPointOnLine3D(fixed_t x, fixed_t y, fixed_t z, line_t *line, vertex_t *result); INT32 P_PointOnLineSide(fixed_t x, fixed_t y, line_t *line); void P_MakeDivline(line_t *li, divline_t *dl); void P_CameraLineOpening(line_t *plinedef); @@ -53,7 +54,7 @@ void P_SetPrecipitationThingPosition(precipmobj_t *thing); void P_CreatePrecipSecNodeList(precipmobj_t *thing, fixed_t x,fixed_t y); boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y); -extern fixed_t opentop, openbottom, openrange, lowfloor; +extern fixed_t opentop, openbottom, openrange, lowfloor, highceiling; void P_LineOpening(line_t *plinedef); diff --git a/src/p_mobj.c b/src/p_mobj.c index 29ba5d043..b4db48f20 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -706,6 +706,45 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover) return true; } +static void P_PlayerFlip(mobj_t *mo) +{ + if (!mo->player) + return; + + G_GhostAddFlip(); + // Flip aiming to match! + + if (mo->player->pflags & PF_NIGHTSMODE) // NiGHTS doesn't use flipcam + { + if (mo->tracer) + mo->tracer->eflags ^= MFE_VERTICALFLIP; + } + else if (mo->player->pflags & PF_FLIPCAM) + { + mo->player->aiming = InvAngle(mo->player->aiming); + if (mo->player-players == displayplayer) + { + localaiming = mo->player->aiming; + if (camera.chase) { + camera.aiming = InvAngle(camera.aiming); + camera.z = mo->z - camera.z + mo->z; + if (mo->eflags & MFE_VERTICALFLIP) + camera.z += FixedMul(20*FRACUNIT, mo->scale); + } + } + else if (mo->player-players == secondarydisplayplayer) + { + localaiming2 = mo->player->aiming; + if (camera2.chase) { + camera2.aiming = InvAngle(camera2.aiming); + camera2.z = mo->z - camera2.z + mo->z; + if (mo->eflags & MFE_VERTICALFLIP) + camera2.z += FixedMul(20*FRACUNIT, mo->scale); + } + } + } +} + // // P_CheckGravity // @@ -718,10 +757,13 @@ void P_CheckGravity(mobj_t *mo, boolean affect) fixed_t gravityadd = 0; boolean no3dfloorgrav = true; // Custom gravity boolean goopgravity = false; + boolean wasflip; I_Assert(mo != NULL); I_Assert(!P_MobjWasRemoved(mo)); + wasflip = (mo->eflags & MFE_VERTICALFLIP) != 0; + if (mo->type != MT_SPINFIRE) mo->eflags &= ~MFE_VERTICALFLIP; @@ -793,10 +835,7 @@ void P_CheckGravity(mobj_t *mo, boolean affect) if (bits & 1) { gravityadd = -gravityadd; - if (mo->eflags & MFE_VERTICALFLIP) - mo->eflags &= ~MFE_VERTICALFLIP; - else - mo->eflags |= MFE_VERTICALFLIP; + mo->eflags ^= MFE_VERTICALFLIP; } } } @@ -858,6 +897,9 @@ void P_CheckGravity(mobj_t *mo, boolean affect) if (affect) mo->momz += FixedMul(gravityadd, mo->scale); + if (mo->player && !!(mo->eflags & MFE_VERTICALFLIP) != wasflip) + P_PlayerFlip(mo); + if (mo->type == MT_SKIM && mo->z + mo->momz <= mo->watertop && mo->z >= mo->watertop) { mo->momz = 0; @@ -921,19 +963,26 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy) player = mo->player; if (player) // valid only if player avatar { - if (abs(player->rmomx) < FixedMul(STOPSPEED, mo->scale) - && abs(player->rmomy) < FixedMul(STOPSPEED, mo->scale) - && (!(player->cmd.forwardmove && !(twodlevel || (player->mo->flags2 & MF2_TWOD))) && !player->cmd.sidemove && !(player->pflags & PF_SPINNING))) + // spinning friction + if (player->pflags & PF_SPINNING && (player->rmomx || player->rmomy) && !(player->pflags & PF_STARTDASH)) + { + const fixed_t ns = FixedDiv(549*FRICTION,500*FRACUNIT); + mo->momx = FixedMul(mo->momx, ns); + mo->momy = FixedMul(mo->momy, ns); + } + else if (abs(player->rmomx) < FixedMul(STOPSPEED, mo->scale) + && abs(player->rmomy) < FixedMul(STOPSPEED, mo->scale) + && (!(player->cmd.forwardmove && !(twodlevel || mo->flags2 & MF2_TWOD)) && !player->cmd.sidemove && !(player->pflags & PF_SPINNING))) { // if in a walking frame, stop moving - if (player && player->panim == PA_WALK) - P_SetPlayerMobjState(player->mo, S_PLAY_STND); + if (player->panim == PA_WALK) + P_SetPlayerMobjState(mo, S_PLAY_STND); mo->momx = player->cmomx; mo->momy = player->cmomy; } else { - if ((oldx == mo->x) && (oldy == mo->y)) // didn't go anywhere + if (oldx == mo->x && oldy == mo->y) // didn't go anywhere { mo->momx = FixedMul(mo->momx, ORIG_FRICTION); mo->momy = FixedMul(mo->momy, ORIG_FRICTION); @@ -944,17 +993,6 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy) mo->momy = FixedMul(mo->momy, mo->friction); } - if (mo->momx || mo->momy) - { - INT32 direction = P_GetPlayerControlDirection(player); - - if (direction == 2) - { - mo->momx >>= 1; - mo->momy >>= 1; - } - } - mo->friction = ORIG_FRICTION; } } @@ -1110,17 +1148,17 @@ void P_XYMovement(mobj_t *mo) oldy = mo->y; // Pushables can break some blocks - if (CheckForBustableBlocks && (mo->flags & MF_PUSHABLE)) + if (CheckForBustableBlocks && mo->flags & MF_PUSHABLE) P_PushableCheckBustables(mo); if (!P_TryMove(mo, mo->x + xmove, mo->y + ymove, true) && !tmsprung) { // blocked move - if (mo->player) { + if (player) { moved = false; - if (mo->player->bot) - B_MoveBlocked(mo->player); + if (player->bot) + B_MoveBlocked(player); } if (mo->flags & MF_BOUNCE) @@ -1170,12 +1208,16 @@ void P_XYMovement(mobj_t *mo) return; } } - else if ((mo->player) || (mo->flags & MF_SLIDEME) - || (mo->flags & MF_PUSHABLE)) + else if (player || mo->flags & (MF_SLIDEME|MF_PUSHABLE)) { // try to slide along it P_SlideMove(mo); xmove = ymove = 0; } + else if (mo->type == MT_SPINFIRE) + { + P_RemoveMobj(mo); + return; + } else if (mo->flags & MF_MISSILE) { // explode a missile @@ -1194,9 +1236,7 @@ void P_XYMovement(mobj_t *mo) //SPLAT TEST ---------------------------------------------------------- #ifdef WALLSPLATS if (blockingline && mo->type != MT_REDRING && mo->type != MT_FIREBALL - && !(mo->flags2 & MF2_AUTOMATIC) && !(mo->flags2 & MF2_RAILRING) - && !(mo->flags2 & MF2_BOUNCERING) && !(mo->flags2 & MF2_EXPLOSION) - && !(mo->flags2 & MF2_SCATTER)) + && !(mo->flags2 & (MF2_AUTOMATIC|MF2_RAILRING|MF2_BOUNCERING|MF2_EXPLOSION|MF2_SCATTER))) // set by last P_TryMove() that failed { divline_t divl; @@ -1221,7 +1261,7 @@ void P_XYMovement(mobj_t *mo) else mo->momx = mo->momy = 0; } - else if (mo->player) + else if (player) moved = true; if (P_MobjWasRemoved(mo)) // MF_SPECIAL touched a player! O_o;; @@ -1230,13 +1270,13 @@ void P_XYMovement(mobj_t *mo) // Check the gravity status. P_CheckGravity(mo, false); - if (mo->player && !moved && (mo->player->pflags & PF_NIGHTSMODE) && mo->target) + if (player && !moved && player->pflags & PF_NIGHTSMODE && mo->target) { angle_t fa; P_UnsetThingPosition(mo); - mo->player->angle_pos = mo->player->old_angle_pos; - mo->player->speed = FixedMul(mo->player->speed, 4*FRACUNIT/5); + player->angle_pos = player->old_angle_pos; + player->speed = FixedMul(player->speed, 4*FRACUNIT/5); if (player->flyangle >= 0 && player->flyangle < 90) player->flyangle = 135; else if (player->flyangle >= 90 && player->flyangle < 180) @@ -1264,28 +1304,19 @@ void P_XYMovement(mobj_t *mo) P_SetThingPosition(mo); } - if ((mo->flags & MF_MISSILE) || (mo->flags2 & MF2_SKULLFLY) || mo->type == MT_SHELL || mo->type == MT_VULTURE) + if (mo->flags & MF_NOCLIPHEIGHT) + return; // no frictions for objects that can pass through floors + + if (mo->flags & MF_MISSILE || mo->flags2 & MF2_SKULLFLY || mo->type == MT_SHELL || mo->type == MT_VULTURE) return; // no friction for missiles ever - if (mo->player && mo->player->homing) // no friction for homing + if (player && player->homing) // no friction for homing return; if (((!(mo->eflags & MFE_VERTICALFLIP) && mo->z > mo->floorz) || (mo->eflags & MFE_VERTICALFLIP && mo->z+mo->height < mo->ceilingz)) - && !(mo->player && (mo->player->pflags & PF_SLIDING))) + && !(player && player->pflags & PF_SLIDING)) return; // no friction when airborne - // spinning friction - if (player) - { - if ((player->pflags & PF_SPINNING) && (player->rmomx || player->rmomy) && !(player->pflags & PF_STARTDASH)) - { - const fixed_t ns = FixedDiv(549*FRICTION,500*FRACUNIT); - mo->momx = FixedMul(mo->momx, ns); - mo->momy = FixedMul(mo->momy, ns); - return; - } - } - P_XYFriction(mo, oldx, oldy); } @@ -1311,9 +1342,12 @@ static void P_SceneryXYMovement(mobj_t *mo) if (!P_SceneryTryMove(mo, mo->x + mo->momx, mo->y + mo->momy)) P_SlideMove(mo); - if (mo->z > mo->floorz) + if ((!(mo->eflags & MFE_VERTICALFLIP) && mo->z > mo->floorz) || (mo->eflags & MFE_VERTICALFLIP && mo->z+mo->height < mo->ceilingz)) return; // no friction when airborne + if (mo->flags & MF_NOCLIPHEIGHT) + return; // no frictions for objects that can pass through floors + P_SceneryXYFriction(mo, oldx, oldy); } @@ -1379,9 +1413,9 @@ static void P_RingZMovement(mobj_t *mo) } else if (mo->z + mo->height > mo->ceilingz && !(mo->flags & MF_NOCLIPHEIGHT)) { - mo->momz = 0; - mo->z = mo->ceilingz - mo->height; + + mo->momz = 0; } } @@ -1654,14 +1688,22 @@ static boolean P_ZMovement(mobj_t *mo) } // clip movement - if (mo->z <= mo->floorz && !(mo->flags & MF_NOCLIPHEIGHT)) + if (((mo->z <= mo->floorz && !(mo->eflags & MFE_VERTICALFLIP)) + || (mo->z + mo->height >= mo->ceilingz && mo->eflags & MFE_VERTICALFLIP)) + && !(mo->flags & MF_NOCLIPHEIGHT)) { + if (mo->eflags & MFE_VERTICALFLIP) + mo->z = mo->ceilingz - mo->height; + else + mo->z = mo->floorz; + // hit the floor if (mo->type == MT_FIREBALL) // special case for the fireball - mo->momz = FixedMul(5*FRACUNIT, mo->scale); + mo->momz = P_MobjFlip(mo)*FixedMul(5*FRACUNIT, mo->scale); + else if (mo->type == MT_SPINFIRE) // elemental shield fire is another exception here + ; else if (mo->flags & MF_MISSILE) { - mo->z = mo->floorz; if (!(mo->flags & MF_NOCLIP)) { // This is a really ugly hard-coded hack to prevent grenades @@ -1672,7 +1714,7 @@ static boolean P_ZMovement(mobj_t *mo) if (mo->flags & MF_GRENADEBOUNCE) { // Going down? (Or up in reverse gravity?) - if (mo->momz*P_MobjFlip(mo) < 0) + if (P_MobjFlip(mo)*mo->momz < 0) { // If going slower than a fracunit, just stop. if (abs(mo->momz) < FixedMul(FRACUNIT, mo->scale)) @@ -1685,7 +1727,7 @@ static boolean P_ZMovement(mobj_t *mo) } // Otherwise bounce up at half speed. else - mo->momz = -FixedMul(mo->momz, FRACUNIT/2); + mo->momz = -mo->momz/2; S_StartSound(mo, mo->info->activesound); } } @@ -1693,9 +1735,14 @@ static boolean P_ZMovement(mobj_t *mo) else { // Don't explode on the sky! - if (mo->subsector->sector->floorpic == skyflatnum + if (!(mo->eflags & MFE_VERTICALFLIP) + && mo->subsector->sector->floorpic == skyflatnum && mo->subsector->sector->floorheight == mo->floorz) P_RemoveMobj(mo); + else if (mo->eflags & MFE_VERTICALFLIP + && mo->subsector->sector->ceilingpic == skyflatnum + && mo->subsector->sector->ceilingheight == mo->ceilingz) + P_RemoveMobj(mo); else P_ExplodeMissile(mo); return false; @@ -1703,28 +1750,15 @@ static boolean P_ZMovement(mobj_t *mo) } } - if (mo->flags2 & MF2_SKULLFLY) // the skull slammed into something - mo->momz = -mo->momz; - - if (mo->momz < 0) // falling + if (P_MobjFlip(mo)*mo->momz < 0) // falling { - // set it once and not continuously - if (tmfloorthing) - { - // Bouncing boxes - if (tmfloorthing->z > tmfloorthing->floorz) - { - if ((tmfloorthing->flags & MF_MONITOR) || (tmfloorthing->flags & MF_PUSHABLE)) - mo->momz = FixedMul(4*FRACUNIT, mo->scale); - } - } - if (!tmfloorthing || tmfloorthing->flags & MF_PUSHABLE - || tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER) - { - if (!tmfloorthing || mo->momz) - mo->eflags |= MFE_JUSTHITFLOOR; - } + if (!tmfloorthing || tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR) + || tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER) + mo->eflags |= MFE_JUSTHITFLOOR; + if (mo->flags2 & MF2_SKULLFLY) // the skull slammed into something + mo->momz = -mo->momz; + else // Flingrings bounce if (mo->type == MT_FLINGRING || mo->type == MT_FLINGCOIN @@ -1733,9 +1767,7 @@ static boolean P_ZMovement(mobj_t *mo) || mo->type == MT_BIGTUMBLEWEED || mo->type == MT_LITTLETUMBLEWEED || mo->type == MT_CANNONBALLDECOR - || mo->type == MT_FALLINGROCK - || ((mo->eflags & MFE_VERTICALFLIP) && mo->type == MT_REDFLAG) - || ((mo->eflags & MFE_VERTICALFLIP) && mo->type == MT_BLUEFLAG)) + || mo->type == MT_FALLINGROCK) { if (maptol & TOL_NIGHTS) mo->momz = -FixedDiv(mo->momz, 10*FRACUNIT); @@ -1756,7 +1788,7 @@ static boolean P_ZMovement(mobj_t *mo) else { // If deafed, give the tumbleweed another random kick if it runs out of steam. - mo->momz += FixedMul(6*FRACUNIT, mo->scale); + mo->momz += P_MobjFlip(mo)*FixedMul(6*FRACUNIT, mo->scale); if (P_Random() & 1) mo->momx += FixedMul(6*FRACUNIT, mo->scale); @@ -1776,7 +1808,7 @@ static boolean P_ZMovement(mobj_t *mo) } else if (mo->type == MT_FALLINGROCK) { - if (mo->momz > FixedMul(2*FRACUNIT, mo->scale)) + if (P_MobjFlip(mo)*mo->momz > FixedMul(2*FRACUNIT, mo->scale)) S_StartSound(mo, mo->info->activesound + P_RandomKey(mo->info->mass)); mo->momz /= 2; // Rocks not so bouncy @@ -1796,14 +1828,15 @@ static boolean P_ZMovement(mobj_t *mo) mo->momz = 0; } } - else if (tmfloorthing && (tmfloorthing->flags & MF_PUSHABLE + else if (tmfloorthing && (tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR) || tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER)) mo->momz = tmfloorthing->momz; else if (!tmfloorthing) mo->momz = 0; } - - mo->z = mo->floorz; + else if (tmfloorthing && (tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR) + || tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER)) + mo->momz = tmfloorthing->momz; if (mo->type == MT_STEAM) return true; @@ -1816,15 +1849,52 @@ static boolean P_ZMovement(mobj_t *mo) P_CheckGravity(mo, true); } - if (mo->z + mo->height > mo->ceilingz && !(mo->flags & MF_NOCLIPHEIGHT)) + if (((mo->z + mo->height > mo->ceilingz && !(mo->eflags & MFE_VERTICALFLIP)) + || (mo->z < mo->floorz && mo->eflags & MFE_VERTICALFLIP)) + && !(mo->flags & MF_NOCLIPHEIGHT)) { - if (mo->momz > 0) // hit the ceiling + if (mo->eflags & MFE_VERTICALFLIP) + mo->z = mo->floorz; + else + mo->z = mo->ceilingz - mo->height; + + if (mo->type == MT_SPINFIRE) + ; + else if ((mo->flags & MF_MISSILE) && !(mo->flags & MF_NOCLIP)) { - // Flingrings bounce - if ((mo->eflags & MFE_VERTICALFLIP) && (mo->type == MT_FLINGRING - || mo->type == MT_FLINGCOIN - || P_WeaponOrPanel(mo->type) - || mo->type == MT_FLINGEMERALD)) + // Hack 2: Electric Boogaloo -SH + if (mo->flags & MF_GRENADEBOUNCE) + { + if (P_MobjFlip(mo)*mo->momz >= 0) + { + mo->momz = -mo->momz; + S_StartSound(mo, mo->info->activesound); + } + } + else + { + // Don't explode on the sky! + if (!(mo->eflags & MFE_VERTICALFLIP) + && mo->subsector->sector->ceilingpic == skyflatnum + && mo->subsector->sector->ceilingheight == mo->ceilingz) + P_RemoveMobj(mo); + else if (mo->eflags & MFE_VERTICALFLIP + && mo->subsector->sector->floorpic == skyflatnum + && mo->subsector->sector->floorheight == mo->floorz) + P_RemoveMobj(mo); + else + P_ExplodeMissile(mo); + return false; + } + } + + if (P_MobjFlip(mo)*mo->momz > 0) // hit the ceiling + { + if (mo->flags2 & MF2_SKULLFLY) // the skull slammed into something + mo->momz = -mo->momz; + else + // Flags bounce + if (mo->type == MT_REDFLAG || mo->type == MT_BLUEFLAG) { if (maptol & TOL_NIGHTS) mo->momz = -FixedDiv(mo->momz, 10*FRACUNIT); @@ -1834,36 +1904,8 @@ static boolean P_ZMovement(mobj_t *mo) else mo->momz = 0; } - - mo->z = mo->ceilingz - mo->height; - - if (mo->flags2 & MF2_SKULLFLY) // the skull slammed into something - mo->momz = -mo->momz; - - - if ((mo->flags & MF_MISSILE) && !(mo->flags & MF_NOCLIP)) - { - // Hack 2: Electric Boogaloo -SH - if (mo->type == MT_THROWNGRENADE || mo->type == MT_CYBRAKDEMON_NAPALM_BOMB_LARGE) - { - if (mo->momz >= 0) - { - mo->momz = -mo->momz; - S_StartSound(mo, mo->info->activesound); - } - } - else - { - // Don't explode on the sky! - if (mo->subsector->sector->ceilingpic == skyflatnum - && mo->subsector->sector->ceilingheight == mo->ceilingz) - P_RemoveMobj(mo); - else - P_ExplodeMissile(mo); - return false; - } - } } + return true; } @@ -1945,15 +1987,19 @@ static void P_PlayerZMovement(mobj_t *mo) return; // clip movement - if (P_IsObjectOnGround(mo)) + if (P_IsObjectOnGround(mo) && !(mo->flags & MF_NOCLIPHEIGHT)) { + if (mo->eflags & MFE_VERTICALFLIP) + mo->z = mo->ceilingz - mo->height; + else + mo->z = mo->floorz; + if (mo->player && (mo->player->pflags & PF_NIGHTSMODE)) { if (mo->player->flyangle < 90 || mo->player->flyangle >= 270) - mo->player->flyangle += 90; + mo->player->flyangle += P_MobjFlip(mo)*90; else - mo->player->flyangle -= 90; - mo->z = mo->floorz; + mo->player->flyangle -= P_MobjFlip(mo)*90; mo->player->speed = FixedMul(mo->player->speed, 4*FRACUNIT/5); goto nightsdone; } @@ -1961,11 +2007,6 @@ static void P_PlayerZMovement(mobj_t *mo) if (mo->state == &states[mo->info->painstate] || mo->state == &states[S_PLAY_SUPERHIT]) P_SetPlayerMobjState(mo, S_PLAY_STND); - if (mo->eflags & MFE_VERTICALFLIP) - mo->z = mo->ceilingz - mo->height; - else - mo->z = mo->floorz; - if (P_MobjFlip(mo)*mo->momz < 0) // falling { // Squat down. Decrease viewheight for a moment after hitting the ground (hard), @@ -1975,25 +2016,10 @@ static void P_PlayerZMovement(mobj_t *mo) mo->player->deltaviewheight = (P_MobjFlip(mo)*mo->momz)>>3; // make sure momz is negative } - // set it once and not continuously - if (tmfloorthing) + if (!tmfloorthing || tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR) + || tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER) // Spin Attack { - if ((tmfloorthing->flags & MF_MONITOR) || (tmfloorthing->flags & MF_PUSHABLE) - || (tmfloorthing->flags2 & MF2_STANDONME)) - { - if (mo->player) - { - if (!(mo->player->pflags & PF_JUMPED)) - tmfloorthing = 0; - } - } - } - - if (P_IsObjectOnGround(mo) && (!tmfloorthing || tmfloorthing->flags & MF_PUSHABLE - || tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER)) // Spin Attack - { - if ((tmfloorthing && mo->momz) || !tmfloorthing) - mo->eflags |= MFE_JUSTHITFLOOR; // Spin Attack + mo->eflags |= MFE_JUSTHITFLOOR; // Spin Attack if (mo->eflags & MFE_JUSTHITFLOOR) { @@ -2055,21 +2081,22 @@ static void P_PlayerZMovement(mobj_t *mo) // Cut momentum in half when you hit the ground and // aren't pressing any controls. - if (!(mo->player->cmd.forwardmove || mo->player->cmd.sidemove) && !mo->player->cmomx && !mo->player->cmomy && !(mo->player->pflags & PF_SPINNING)) + if (!mo->player || (!(mo->player->cmd.forwardmove || mo->player->cmd.sidemove) && !mo->player->cmomx && !mo->player->cmomy && !(mo->player->pflags & PF_SPINNING))) { mo->momx = mo->momx/2; mo->momy = mo->momy/2; } } - if (mo->health) + if (mo->health && mo->player) { if (mo->player->pflags & PF_GLIDING) // ground gliding { mo->player->skidtime = TICRATE; mo->tics = -1; } - else if (mo->player->pflags & PF_JUMPED || (mo->player->pflags & (PF_SPINNING|PF_USEDOWN)) != (PF_SPINNING|PF_USEDOWN)) + else if (mo->player->pflags & PF_JUMPED || (mo->player->pflags & (PF_SPINNING|PF_USEDOWN)) != (PF_SPINNING|PF_USEDOWN) + || mo->player->powers[pw_tailsfly] || (mo->state >= &states[S_PLAY_SPC1] && mo->state <= &states[S_PLAY_SPC4])) { if (mo->player->cmomx || mo->player->cmomy) { @@ -2104,69 +2131,59 @@ static void P_PlayerZMovement(mobj_t *mo) mo->player->secondjump = 0; mo->player->glidetime = 0; mo->player->climbing = 0; + mo->player->powers[pw_tailsfly] = 0; } } if (mo->player && !(mo->player->pflags & PF_SPINNING)) mo->player->pflags &= ~PF_STARTDASH; - if (!tmfloorthing || tmfloorthing->flags & MF_PUSHABLE - || tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER) + if (tmfloorthing && (tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR) + || tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER)) + mo->momz = tmfloorthing->momz; + else if (!tmfloorthing) mo->momz = 0; } + else if (tmfloorthing && (tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR) + || tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER)) + mo->momz = tmfloorthing->momz; } else if (!(mo->flags & MF_NOGRAVITY)) // Gravity here! { - boolean wasflip; - /// \todo may not be needed (done in P_MobjThinker normally) - mo->eflags &= ~MFE_JUSTHITFLOOR; - - wasflip = (mo->eflags & MFE_VERTICALFLIP) != 0; - P_CheckGravity(mo, true); - - if ((wasflip && !(mo->eflags & MFE_VERTICALFLIP)) - || (!wasflip && (mo->eflags & MFE_VERTICALFLIP))) + if (P_IsObjectInGoop(mo) && !(mo->flags & MF_NOCLIPHEIGHT)) { - G_GhostAddFlip(); - // Flip aiming to match! - if (mo->player->pflags & PF_FLIPCAM) + if (mo->z < mo->floorz) { - mo->player->aiming = InvAngle(mo->player->aiming); - if (mo->player-players == displayplayer) - { - localaiming = mo->player->aiming; - if (camera.chase) { - camera.aiming = InvAngle(camera.aiming); - camera.z = mo->z - camera.z + mo->z; - if (mo->eflags & MFE_VERTICALFLIP) - camera.z += FixedMul(20*FRACUNIT, mo->scale); - } - } - else if (mo->player-players == secondarydisplayplayer) - { - localaiming2 = mo->player->aiming; - if (camera2.chase) { - camera2.aiming = InvAngle(camera2.aiming); - camera2.z = mo->z - camera2.z + mo->z; - if (mo->eflags & MFE_VERTICALFLIP) - camera2.z += FixedMul(20*FRACUNIT, mo->scale); - } - } + mo->z = mo->floorz; + mo->momz = 0; + } + else if (mo->z + mo->height > mo->ceilingz) + { + mo->z = mo->ceilingz - mo->height; + mo->momz = 0; } } + /// \todo may not be needed (done in P_MobjThinker normally) + mo->eflags &= ~MFE_JUSTHITFLOOR; + P_CheckGravity(mo, true); } nightsdone: - if ((mo->eflags & MFE_VERTICALFLIP && mo->z < mo->floorz) || (!(mo->eflags & MFE_VERTICALFLIP) && mo->z + mo->height > mo->ceilingz)) + if (((mo->eflags & MFE_VERTICALFLIP && mo->z < mo->floorz) || (!(mo->eflags & MFE_VERTICALFLIP) && mo->z + mo->height > mo->ceilingz)) + && !(mo->flags & MF_NOCLIPHEIGHT)) { + if (mo->eflags & MFE_VERTICALFLIP) + mo->z = mo->floorz; + else + mo->z = mo->ceilingz - mo->height; + if (mo->player && (mo->player->pflags & PF_NIGHTSMODE)) { if (mo->player->flyangle < 90 || mo->player->flyangle >= 270) - mo->player->flyangle -= 90; + mo->player->flyangle -= P_MobjFlip(mo)*90; else - mo->player->flyangle += 90; + mo->player->flyangle += P_MobjFlip(mo)*90; mo->player->flyangle %= 360; - mo->z = mo->ceilingz - mo->height; mo->player->speed = FixedMul(mo->player->speed, 4*FRACUNIT/5); } @@ -2206,11 +2223,6 @@ nightsdone: if (!(mo->player && mo->player->climbing)) mo->momz = 0; } - - if (mo->eflags & MFE_VERTICALFLIP) - mo->z = mo->floorz; - else - mo->z = mo->ceilingz - mo->height; } } @@ -2352,20 +2364,25 @@ static boolean P_SceneryZMovement(mobj_t *mo) } // clip movement - if (mo->z <= mo->floorz && !(mo->flags & MF_NOCLIPHEIGHT)) + if (((mo->z <= mo->floorz && !(mo->eflags & MFE_VERTICALFLIP)) + || (mo->z + mo->height >= mo->ceilingz && mo->eflags & MFE_VERTICALFLIP)) + && !(mo->flags & MF_NOCLIPHEIGHT)) { - mo->z = mo->floorz; + if (mo->eflags & MFE_VERTICALFLIP) + mo->z = mo->ceilingz - mo->height; + else + mo->z = mo->floorz; - if (mo->momz < 0) // falling + if (P_MobjFlip(mo)*mo->momz < 0) // falling { - if (!tmfloorthing || tmfloorthing->flags & MF_PUSHABLE + if (!tmfloorthing || tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR) || tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER) - { - if (!tmfloorthing || mo->momz) mo->eflags |= MFE_JUSTHITFLOOR; // Spin Attack - } - if (!tmfloorthing) + if (tmfloorthing && (tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR) + || tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER)) + mo->momz = tmfloorthing->momz; + else if (!tmfloorthing) mo->momz = 0; } } @@ -2377,15 +2394,17 @@ static boolean P_SceneryZMovement(mobj_t *mo) P_CheckGravity(mo, true); } - if (mo->z + mo->height > mo->ceilingz && !(mo->flags & MF_NOCLIPHEIGHT)) + if (((mo->z + mo->height > mo->ceilingz && !(mo->eflags & MFE_VERTICALFLIP)) + || (mo->z < mo->floorz && mo->eflags & MFE_VERTICALFLIP)) + && !(mo->flags & MF_NOCLIPHEIGHT)) { - if (mo->momz > 0) - { - // hit the ceiling - mo->momz = 0; - } + if (mo->eflags & MFE_VERTICALFLIP) + mo->z = mo->floorz; + else + mo->z = mo->ceilingz - mo->height; - mo->z = mo->ceilingz - mo->height; + if (P_MobjFlip(mo)*mo->momz > 0) // hit the ceiling + mo->momz = 0; } return true; @@ -2398,7 +2417,7 @@ static boolean P_SceneryZMovement(mobj_t *mo) boolean P_CanRunOnWater(player_t *player, ffloor_t *rover) { if (!(player->pflags & PF_NIGHTSMODE) && !player->homing - && (((player->charability == CA_SWIM) || player->powers[pw_super]) && player->mo->ceilingz-*rover->topheight >= player->mo->height) + && (((player->charability == CA_SWIM) || player->powers[pw_super] || player->charflags & SF_RUNONWATER) && player->mo->ceilingz-*rover->topheight >= player->mo->height) && (rover->flags & FF_SWIMMABLE) && !(player->pflags & PF_SPINNING) && player->speed > FixedMul(player->runspeed, player->mo->scale) && !(player->pflags & PF_SLIDING) && abs(player->mo->z - *rover->topheight) < FixedMul(30*FRACUNIT, player->mo->scale)) @@ -2682,6 +2701,7 @@ static void P_SceneryCheckWater(mobj_t *mobj) static boolean P_CameraCheckHeat(camera_t *thiscam) { sector_t *sector; + fixed_t halfheight = thiscam->z + (thiscam->height >> 1); // see if we are in water sector = thiscam->subsector->sector; @@ -2695,17 +2715,14 @@ static boolean P_CameraCheckHeat(camera_t *thiscam) for (rover = sector->ffloors; rover; rover = rover->next) { - if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKOTHERS) - continue; - if (*rover->topheight <= thiscam->z - || *rover->bottomheight > (thiscam->z + (thiscam->height >> 1))) + if (!(rover->flags & FF_EXISTS)) continue; - if (thiscam->z + (thiscam->height >> 1) < *rover->topheight) - { - if (P_FindSpecialLineFromTag(13, rover->master->frontsector->tag, -1) != -1) - return true; - } + if (halfheight >= *rover->topheight || halfheight <= *rover->bottomheight) + continue; + + if (P_FindSpecialLineFromTag(13, rover->master->frontsector->tag, -1) != -1) + return true; } } @@ -2715,6 +2732,7 @@ static boolean P_CameraCheckHeat(camera_t *thiscam) static boolean P_CameraCheckWater(camera_t *thiscam) { sector_t *sector; + fixed_t halfheight = thiscam->z + (thiscam->height >> 1); // see if we are in water sector = thiscam->subsector->sector; @@ -2727,12 +2745,11 @@ static boolean P_CameraCheckWater(camera_t *thiscam) { if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKOTHERS) continue; - if (*rover->topheight <= thiscam->z - || *rover->bottomheight > (thiscam->z + (thiscam->height >> 1))) + + if (halfheight >= *rover->topheight || halfheight <= *rover->bottomheight) continue; - if (thiscam->z + (thiscam->height >> 1) < *rover->topheight) - return true; + return true; } } @@ -2774,13 +2791,30 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled || (thiscam == &camera2 && players[secondarydisplayplayer].mo && (players[secondarydisplayplayer].mo->flags2 & MF2_TWOD))) itsatwodlevel = true; - // Are we in water? - if (player->pflags & PF_FLIPCAM && player->mo->eflags & MFE_VERTICALFLIP) + if (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP) postimg = postimg_flip; - else if (P_CameraCheckWater(thiscam)) - postimg = postimg_water; - else if (P_CameraCheckHeat(thiscam)) - postimg = postimg_heat; + else if (player->awayviewtics) + { + camera_t dummycam; + dummycam.subsector = player->awayviewmobj->subsector; + dummycam.x = player->awayviewmobj->x; + dummycam.y = player->awayviewmobj->y; + dummycam.z = player->awayviewmobj->z; + dummycam.height = 40*FRACUNIT; // alt view height is 20*FRACUNIT + // Are we in water? + if (P_CameraCheckWater(&dummycam)) + postimg = postimg_water; + else if (P_CameraCheckHeat(&dummycam)) + postimg = postimg_heat; + } + else + { + // Are we in water? + if (P_CameraCheckWater(thiscam)) + postimg = postimg_water; + else if (P_CameraCheckHeat(thiscam)) + postimg = postimg_heat; + } if (postimg != postimg_none) { @@ -2876,12 +2910,10 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled static void P_PlayerMobjThinker(mobj_t *mobj) { msecnode_t *node; - boolean wasflip; I_Assert(mobj != NULL); I_Assert(!P_MobjWasRemoved(mobj)); - wasflip = (mobj->eflags & MFE_VERTICALFLIP) != 0; P_MobjCheckWater(mobj); // momentum movement @@ -2917,36 +2949,6 @@ static void P_PlayerMobjThinker(mobj_t *mobj) else P_TryMove(mobj, mobj->x, mobj->y, true); - if ((wasflip && !(mobj->eflags & MFE_VERTICALFLIP)) - || (!wasflip && (mobj->eflags & MFE_VERTICALFLIP))) - { // Flip aiming to match! - G_GhostAddFlip(); - if (mobj->player->pflags & PF_FLIPCAM) - { - mobj->player->aiming = InvAngle(mobj->player->aiming); - if (mobj->player-players == displayplayer) - { - localaiming = mobj->player->aiming; - if (camera.chase) { - camera.aiming = InvAngle(camera.aiming); - camera.z = mobj->z - camera.z + mobj->z; - if (mobj->eflags & MFE_VERTICALFLIP) - camera.z += FixedMul(20*FRACUNIT, mobj->scale); - } - } - else if (mobj->player-players == secondarydisplayplayer) - { - localaiming2 = mobj->player->aiming; - if (camera2.chase) { - camera2.aiming = InvAngle(camera2.aiming); - camera2.z = mobj->z - camera2.z + mobj->z; - if (mobj->eflags & MFE_VERTICALFLIP) - camera2.z += FixedMul(20*FRACUNIT, mobj->scale); - } - } - } - } - if (!(netgame && mobj->player && mobj->player->spectator)) { // Crumbling platforms @@ -3020,7 +3022,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj) if (!(mobj->eflags & MFE_ONGROUND) || mobj->momz || ((mobj->eflags & MFE_VERTICALFLIP) && mobj->z + mobj->height != mobj->ceilingz) || (!(mobj->eflags & MFE_VERTICALFLIP) && mobj->z != mobj->floorz) - || ((mobj->eflags & (MFE_UNDERWATER|MFE_GOOWATER)) == (MFE_UNDERWATER|MFE_GOOWATER))) + || P_IsObjectInGoop(mobj)) { P_PlayerZMovement(mobj); P_CheckPosition(mobj, mobj->x, mobj->y); // Need this to pick up objects! @@ -3030,8 +3032,18 @@ static void P_PlayerMobjThinker(mobj_t *mobj) } else { - mobj->player->jumping = 0; - mobj->player->pflags &= ~PF_JUMPED; + if (mobj->player) + { + mobj->player->jumping = 0; + mobj->player->pflags &= ~PF_JUMPED; + if (mobj->player->secondjump || mobj->player->powers[pw_tailsfly]) + { + mobj->player->secondjump = 0; + mobj->player->powers[pw_tailsfly] = 0; + P_SetPlayerMobjState(mobj, S_PLAY_RUN1); + } + } + mobj->pmomz = 0; mobj->eflags &= ~MFE_JUSTHITFLOOR; } @@ -3503,9 +3515,30 @@ static void P_Boss3Thinker(mobj_t *mobj) if (!mobj->reactiontime && mobj->health <= mobj->info->damage) { // Spawn pinch dummies from the center when we're leaving it. + thinker_t *th; + mobj_t *mo2; mobj_t *dummy; SINT8 way = mobj->threshold - 1; // 0 through 4. SINT8 way2; + + i = 0; // reset i to 0 so we can check how many clones we've removed + + // scan the thinkers to make sure all the old pinch dummies are gone before making new ones + // this can happen if the boss was hurt earlier than expected + for (th = thinkercap.next; th != &thinkercap; th = th->next) + { + if (th->function.acp1 != (actionf_p1)P_MobjThinker) + continue; + + mo2 = (mobj_t *)th; + if (mo2->type == (mobjtype_t)mobj->info->mass && mo2->tracer == mobj) + { + P_RemoveMobj(mo2); + i++; + } + if (i == 2) // we've already removed 2 of these, let's stop now + break; + } way = (way + P_RandomRange(1,3)) % 5; // dummy 1 at one of the first three options after eggmobile dummy = P_SpawnMobj(mobj->x, mobj->y, mobj->z, mobj->info->mass); @@ -4864,15 +4897,15 @@ static void P_MoveHoop(mobj_t *mobj) TVector v; TVector *res; fixed_t finalx, finaly, finalz; - fixed_t mthingx, mthingy, mthingz; + fixed_t x, y, z; //I_Assert(mobj->target != NULL); if (!mobj->target) /// \todo DEBUG ME! Target was P_RemoveMobj'd at some point, and therefore no longer valid! return; - mthingx = mobj->target->x; - mthingy = mobj->target->y; - mthingz = mobj->target->z+mobj->target->height/2; + x = mobj->target->x; + y = mobj->target->y; + z = mobj->target->z+mobj->target->height/2; // Make the sprite travel towards the center of the hoop v[0] = FixedMul(FINECOSINE(fa),fuse); @@ -4885,9 +4918,9 @@ static void P_MoveHoop(mobj_t *mobj) res = VectorMatrixMultiply(v, *RotateZMatrix(FixedAngle(mobj->target->movecount*FRACUNIT))); M_Memcpy(&v, res, sizeof (v)); - finalx = mthingx + v[0]; - finaly = mthingy + v[1]; - finalz = mthingz + v[2]; + finalx = x + v[0]; + finaly = y + v[1]; + finalz = z + v[2]; P_UnsetThingPosition(mobj); mobj->x = finalx; @@ -5068,6 +5101,7 @@ void P_SetScale(mobj_t *mobj, fixed_t newscale) { G_GhostAddScale(newscale); player->viewheight = FixedMul(FixedDiv(player->viewheight, oldscale), newscale); // Nonono don't calculate viewheight elsewhere, this is the best place for it! + player->dashspeed = FixedMul(FixedDiv(player->dashspeed, oldscale), newscale); // Prevents the player from having to re-charge up spindash if the player grew in size } } @@ -5887,11 +5921,17 @@ void P_MobjThinker(mobj_t *mobj) /// \todo Have the player's dead body completely finish its animation even if they've already respawned. if (!(mobj->flags2 & MF2_DONTDRAW)) { - if (mobj->player && mobj->player->deadtimer > 3*TICRATE) + if (!mobj->fuse) { // Go away. /// \todo Actually go ahead and remove mobj completely, and fix any bugs and crashes doing this creates. Chasecam should stop moving, and F12 should never return to it. mobj->momz = 0; - mobj->flags2 |= MF2_DONTDRAW; + if (mobj->player) + mobj->flags2 |= MF2_DONTDRAW; + else // safe to remove, nobody's going to complain! + { + P_RemoveMobj(mobj); + return; + } } else // Apply gravity to fall downwards. P_SetObjectMomZ(mobj, -2*FRACUNIT/3, true); @@ -6360,7 +6400,7 @@ void P_MobjThinker(mobj_t *mobj) if (mobj->state != &states[S_SHELL]) { - mobj->angle = R_PointToAngle2(mobj->x, mobj->y, mobj->x+mobj->momx, mobj->y+mobj->momy); + mobj->angle = R_PointToAngle2(0, 0, mobj->momx, mobj->momy); P_InstaThrust(mobj, mobj->angle, FixedMul(mobj->info->speed, mobj->scale)); } break; @@ -6426,7 +6466,7 @@ void P_MobjThinker(mobj_t *mobj) if (mobj->eflags & MFE_VERTICALFLIP) mobj->z = mobj->ceilingz - mobj->height; else - mobj->z = mobj->floorz+1; + mobj->z = mobj->floorz; // THERE IS NO BREAK HERE ON PURPOSE default: // check mobj against possible water content, before movement code @@ -6773,6 +6813,8 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s case MT_NIGHTSCORE: P_RemoveMobj(mobj); return; + case MT_PLAYER: + break; // don't remove default: P_SetMobjState(mobj, mobj->info->xdeathstate); // will remove the mobj if S_NULL. break; @@ -6797,7 +6839,7 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s if (!(mobj->eflags & MFE_ONGROUND) || mobj->momz || ((mobj->eflags & MFE_VERTICALFLIP) && mobj->z + mobj->height != mobj->ceilingz) || (!(mobj->eflags & MFE_VERTICALFLIP) && mobj->z != mobj->floorz) - || ((mobj->eflags & (MFE_UNDERWATER|MFE_GOOWATER)) == (MFE_UNDERWATER|MFE_GOOWATER))) + || P_IsObjectInGoop(mobj)) { if (!P_ZMovement(mobj)) return; // mobj was removed @@ -6807,6 +6849,17 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s } else { + if (mobj->player) + { + mobj->player->jumping = 0; + mobj->player->pflags &= ~PF_JUMPED; + if (mobj->player->secondjump || mobj->player->powers[pw_tailsfly]) + { + mobj->player->secondjump = 0; + mobj->player->powers[pw_tailsfly] = 0; + P_SetPlayerMobjState(mobj, S_PLAY_RUN1); + } + } mobj->pmomz = 0; // to prevent that weird rocketing gargoyle bug mobj->eflags &= ~MFE_JUSTHITFLOOR; } @@ -6995,7 +7048,7 @@ void P_SceneryThinker(mobj_t *mobj) if (!(mobj->eflags & MFE_ONGROUND) || mobj->momz || ((mobj->eflags & MFE_VERTICALFLIP) && mobj->z + mobj->height != mobj->ceilingz) || (!(mobj->eflags & MFE_VERTICALFLIP) && mobj->z != mobj->floorz) - || ((mobj->eflags & (MFE_UNDERWATER|MFE_GOOWATER)) == (MFE_UNDERWATER|MFE_GOOWATER))) + || P_IsObjectInGoop(mobj)) { if (!P_SceneryZMovement(mobj)) return; // mobj was removed @@ -7007,6 +7060,17 @@ void P_SceneryThinker(mobj_t *mobj) } else { + if (mobj->player) + { + mobj->player->jumping = 0; + mobj->player->pflags &= ~PF_JUMPED; + if (mobj->player->secondjump || mobj->player->powers[pw_tailsfly]) + { + mobj->player->secondjump = 0; + mobj->player->powers[pw_tailsfly] = 0; + P_SetPlayerMobjState(mobj, S_PLAY_RUN1); + } + } mobj->pmomz = 0; // to prevent that weird rocketing gargoyle bug mobj->eflags &= ~MFE_JUSTHITFLOOR; } @@ -7101,12 +7165,22 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) mobj->z = z; #ifdef HAVE_BLUA - if (!LUAh_MobjSpawn(mobj)) + // DANGER! This can cause P_SpawnMobj to return NULL! + // Avoid using P_RemoveMobj on the newly created mobj in "MobjSpawn" Lua hooks! + if (LUAh_MobjSpawn(mobj)) + { + if (P_MobjWasRemoved(mobj)) + return NULL; + } + else if (P_MobjWasRemoved(mobj)) + return NULL; + else #endif switch (mobj->type) { case MT_CYBRAKDEMON_NAPALM_BOMB_LARGE: mobj->fuse = mobj->info->mass; + break; case MT_BLACKEGGMAN: { mobj_t *spawn = P_SpawnMobj(mobj->x, mobj->z, mobj->z+mobj->height-16*FRACUNIT, MT_BLACKEGGMAN_HELPER); @@ -7230,7 +7304,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) astate = st; #endif st->action.acp1(mobj); - // DANGER! This is the ONLY way for P_SpawnMobj to return NULL! + // DANGER! This can cause P_SpawnMobj to return NULL! // Avoid using MF_RUNSPAWNFUNC on mobjs whose spawn state expects target or tracer to already be set! if (P_MobjWasRemoved(mobj)) return NULL; @@ -7653,6 +7727,7 @@ void P_PrecipitationEffects(void) void P_RespawnSpecials(void) { fixed_t x, y, z; + subsector_t *ss; mobj_t *mo = NULL; mapthing_t *mthing = NULL; @@ -7687,14 +7762,13 @@ void P_RespawnSpecials(void) mobjtype_t i; x = mthing->x << FRACBITS; y = mthing->y << FRACBITS; + ss = R_PointInSubsector(x, y); // find which type to spawn for (i = 0; i < NUMMOBJTYPES; i++) if (mthing->type == mobjinfo[i].doomednum) break; - z = (mthing->options >> ZSHIFT) * FRACUNIT; - //CTF rings should continue to respawn as normal rings outside of CTF. if (gametype != GT_CTF) { @@ -7702,28 +7776,31 @@ void P_RespawnSpecials(void) i = MT_RING; } + if (mthing->options & MTF_OBJECTFLIP) + { + z = ss->sector->ceilingheight - (mthing->options >> ZSHIFT) * FRACUNIT; + if (mthing->options & MTF_AMBUSH + && (i == MT_RING || i == MT_REDTEAMRING || i == MT_BLUETEAMRING || i == MT_COIN || P_WeaponOrPanel(i))) + z -= 24*FRACUNIT; + z -= mobjinfo[i].height; // Don't forget the height! + } + else + { + z = ss->sector->floorheight + (mthing->options >> ZSHIFT) * FRACUNIT; + if (mthing->options & MTF_AMBUSH + && (i == MT_RING || i == MT_REDTEAMRING || i == MT_BLUETEAMRING || i == MT_COIN || P_WeaponOrPanel(i))) + z += 24*FRACUNIT; + } + mo = P_SpawnMobj(x, y, z, i); mo->spawnpoint = mthing; mo->angle = ANGLE_45 * (mthing->angle/45); if (mthing->options & MTF_OBJECTFLIP) { - mo->z = mo->ceilingz - (mthing->options >> ZSHIFT) * FRACUNIT; - if (mthing->options & MTF_AMBUSH - && (i == MT_RING || i == MT_REDTEAMRING || i == MT_BLUETEAMRING || i == MT_COIN || P_WeaponOrPanel(i))) - mo->z -= 24*FRACUNIT; - mo->z -= mobjinfo[i].height; // Don't forget the height! - mo->eflags |= MFE_VERTICALFLIP; mo->flags2 |= MF2_OBJECTFLIP; } - else - { - mo->z = mo->floorz + (mthing->options >> ZSHIFT) * FRACUNIT; - if (mthing->options & MTF_AMBUSH - && (i == MT_RING || i == MT_REDTEAMRING || i == MT_BLUETEAMRING || i == MT_COIN || P_WeaponOrPanel(i))) - mo->z += 24*FRACUNIT; - } } // pull it from the que iquetail = (iquetail+1)&(ITEMQUESIZE-1); @@ -7744,7 +7821,14 @@ void P_SpawnPlayer(INT32 playernum) // spawn as spectator determination if (!G_GametypeHasSpectators()) - p->spectator = false; + { + // Special case for (NiGHTS) special stages! + // if stage has already started, force players to become spectators until the next stage + if (multiplayer && netgame && G_IsSpecialStage(gamemap) && useNightsSS && leveltime > 0) + p->spectator = true; + else + p->spectator = false; + } else if (netgame && p->jointime < 1) p->spectator = true; else if (multiplayer && !netgame) @@ -7892,7 +7976,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing) { // Flagging a player's ambush will make them start on the ceiling // Objectflip inverts - if (((mthing->options & MTF_AMBUSH) == MTF_AMBUSH) ^ ((mthing->options & MTF_OBJECTFLIP) == MTF_OBJECTFLIP)) + if (!!(mthing->options & MTF_AMBUSH) ^ !!(mthing->options & MTF_OBJECTFLIP)) { z = sector->ceilingheight - mobjinfo[MT_PLAYER].height; if (mthing->options >> ZSHIFT) @@ -7905,8 +7989,11 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing) z += ((mthing->options >> ZSHIFT) << FRACBITS); } - if (mthing->options & MTF_OBJECTFLIP) - mobj->flags2 |= MF2_OBJECTFLIP; // flip the player! + if (mthing->options & MTF_OBJECTFLIP) // flip the player! + { + mobj->eflags |= MFE_VERTICALFLIP; + mobj->flags2 |= MF2_OBJECTFLIP; + } } else z = sector->floorheight; @@ -8230,16 +8317,7 @@ void P_SpawnMapThing(mapthing_t *mthing) z = ONFLOORZ; else if (i == MT_SPECIALSPIKEBALL || P_WeaponOrPanel(i) || i == MT_EMERALDSPAWN || i == MT_EMMY) { - if (!(mthing->options & MTF_OBJECTFLIP)) - { - z = ss->sector->floorheight; - - if (mthing->options & MTF_AMBUSH) // Special flag for rings - z += 24*FRACUNIT; - if (mthing->options >> ZSHIFT) - z += (mthing->options >> ZSHIFT)*FRACUNIT; - } - else + if (mthing->options & MTF_OBJECTFLIP) { z = ss->sector->ceilingheight; @@ -8250,6 +8328,15 @@ void P_SpawnMapThing(mapthing_t *mthing) z -= mobjinfo[i].height; //Don't forget the height! } + else + { + z = ss->sector->floorheight; + + if (mthing->options & MTF_AMBUSH) // Special flag for rings + z += 24*FRACUNIT; + if (mthing->options >> ZSHIFT) + z += (mthing->options >> ZSHIFT)*FRACUNIT; + } if (z == ONFLOORZ) mthing->z = 0; @@ -8259,7 +8346,7 @@ void P_SpawnMapThing(mapthing_t *mthing) else { fixed_t offset = 0; - boolean flip = (((mobjinfo[i].flags & MF_SPAWNCEILING) == MF_SPAWNCEILING) ^ ((mthing->options & MTF_OBJECTFLIP) == MTF_OBJECTFLIP)); + boolean flip = (!!(mobjinfo[i].flags & MF_SPAWNCEILING) ^ !!(mthing->options & MTF_OBJECTFLIP)); // base positions if (flip) @@ -8326,7 +8413,7 @@ void P_SpawnMapThing(mapthing_t *mthing) if (mthing->angle) mobj->health = mthing->angle; else - mobj->health = FixedMul((ss->sector->ceilingheight-ss->sector->floorheight), 3*(FRACUNIT/4))>>FRACBITS; + mobj->health = FixedMul(ss->sector->ceilingheight-ss->sector->floorheight, 3*(FRACUNIT/4))>>FRACBITS; break; case MT_WATERDRIP: if (mthing->angle) @@ -8517,7 +8604,7 @@ ML_NOCLIMB : Direction not controllable if (mthing->options & MTF_OBJECTSPECIAL) // No egg trap for this boss mobj->flags2 |= MF2_BOSSNOTRAP; - z = R_PointInSubsector(x, y)->sector->floorheight + ((mthing->options >> (ZSHIFT)) << FRACBITS); + z = ss->sector->floorheight + ((mthing->options >> (ZSHIFT)) << FRACBITS); mthing->z = (INT16)(z>>FRACBITS); } @@ -8569,22 +8656,6 @@ ML_NOCLIMB : Direction not controllable // Subtract 1 here for the correct value. mobj->health = 1 << (tokenbits - 1); } -/* else if (i == MT_EGGMOBILE && mthing->options & MTF_AMBUSH) - { - mobj_t *spikemobj; - spikemobj = P_SpawnMobj(x, y, z, MT_SPIKEBALL); - P_SetTarget(&spikemobj->target, mobj); - spikemobj->angle = 0; - spikemobj = P_SpawnMobj(x, y, z, MT_SPIKEBALL); - P_SetTarget(&spikemobj->target, mobj); - spikemobj->angle = ANGLE_90; - spikemobj = P_SpawnMobj(x, y, z, MT_SPIKEBALL); - P_SetTarget(&spikemobj->target, mobj); - spikemobj->angle = ANGLE_180; - spikemobj = P_SpawnMobj(x, y, z, MT_SPIKEBALL); - P_SetTarget(&spikemobj->target, mobj); - spikemobj->angle = ANGLE_270; - }*/ else if (i == MT_CYBRAKDEMON && mthing->options & MTF_AMBUSH) { mobj_t *elecmobj; @@ -8778,13 +8849,16 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) { mobj_t *mobj = NULL; INT32 r, i; - fixed_t x, y, z, finalx, finaly, finalz, mthingx, mthingy, mthingz; + fixed_t x, y, z, finalx, finaly, finalz; + sector_t *sec; TVector v, *res; angle_t closestangle, fa; x = mthing->x << FRACBITS; y = mthing->y << FRACBITS; + sec = R_PointInSubsector(x, y)->sector; + // NiGHTS hoop! if (mthing->type == 1705) { @@ -8792,25 +8866,22 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) mobj_t *hoopcenter; INT16 spewangle; - mthingx = mthing->x << FRACBITS; - mthingy = mthing->y << FRACBITS; + z = mthing->options << FRACBITS; - mthingz = mthing->options << FRACBITS; - - hoopcenter = P_SpawnMobj(mthingx, mthingy, mthingz, MT_HOOPCENTER); + hoopcenter = P_SpawnMobj(x, y, z, MT_HOOPCENTER); hoopcenter->spawnpoint = mthing; // Screw these damn hoops, I need this thinker. //hoopcenter->flags |= MF_NOTHINK; - mthingz += R_PointInSubsector(mthingx, mthingy)->sector->floorheight; + z += sec->floorheight; - hoopcenter->z = mthingz - hoopcenter->height/2; + hoopcenter->z = z - hoopcenter->height/2; P_UnsetThingPosition(hoopcenter); - hoopcenter->x = mthingx; - hoopcenter->y = mthingy; + hoopcenter->x = x; + hoopcenter->y = y; P_SetThingPosition(hoopcenter); // Scale 0-255 to 0-359 =( @@ -8841,9 +8912,9 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) res = VectorMatrixMultiply(v, *RotateZMatrix(closestangle)); M_Memcpy(&v, res, sizeof (v)); - finalx = mthingx + v[0]; - finaly = mthingy + v[1]; - finalz = mthingz + v[2]; + finalx = x + v[0]; + finaly = y + v[1]; + finalz = z + v[2]; mobj = P_SpawnMobj(finalx, finaly, finalz, MT_HOOP); @@ -8879,9 +8950,9 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) res = VectorMatrixMultiply(v, *RotateZMatrix(closestangle)); M_Memcpy(&v, res, sizeof (v)); - finalx = mthingx + v[0]; - finaly = mthingy + v[1]; - finalz = mthingz + v[2]; + finalx = x + v[0]; + finaly = y + v[1]; + finalz = z + v[2]; mobj = P_SpawnMobj(finalx, finaly, finalz, MT_HOOPCOLLIDE); mobj->z -= mobj->height/2; @@ -8906,9 +8977,9 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) res = VectorMatrixMultiply(v, *RotateZMatrix(closestangle)); M_Memcpy(&v, res, sizeof (v)); - finalx = mthingx + v[0]; - finaly = mthingy + v[1]; - finalz = mthingz + v[2]; + finalx = x + v[0]; + finaly = y + v[1]; + finalz = z + v[2]; mobj = P_SpawnMobj(finalx, finaly, finalz, MT_HOOPCOLLIDE); mobj->z -= mobj->height/2; @@ -8931,21 +9002,18 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) INT32 hoopsize; INT32 hoopplacement; - mthingx = mthing->x << FRACBITS; - mthingy = mthing->y << FRACBITS; - // Save our flags! - mthingz = (mthing->options>>ZSHIFT) << FRACBITS; + z = (mthing->options>>ZSHIFT) << FRACBITS; - hoopcenter = P_SpawnMobj(mthingx, mthingy, mthingz, MT_HOOPCENTER); + hoopcenter = P_SpawnMobj(x, y, z, MT_HOOPCENTER); hoopcenter->spawnpoint = mthing; - mthingz += R_PointInSubsector(mthingx, mthingy)->sector->floorheight; - hoopcenter->z = mthingz - hoopcenter->height/2; + z += sec->floorheight; + hoopcenter->z = z - hoopcenter->height/2; P_UnsetThingPosition(hoopcenter); - hoopcenter->x = mthingx; - hoopcenter->y = mthingy; + hoopcenter->x = x; + hoopcenter->y = y; P_SetThingPosition(hoopcenter); // Scale 0-255 to 0-359 =( @@ -8982,9 +9050,9 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) res = VectorMatrixMultiply(v, *RotateZMatrix(closestangle)); M_Memcpy(&v, res, sizeof (v)); - finalx = mthingx + v[0]; - finaly = mthingy + v[1]; - finalz = mthingz + v[2]; + finalx = x + v[0]; + finaly = y + v[1]; + finalz = z + v[2]; mobj = P_SpawnMobj(finalx, finaly, finalz, MT_HOOP); @@ -9031,9 +9099,9 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) res = VectorMatrixMultiply(v, *RotateZMatrix(closestangle)); M_Memcpy(&v, res, sizeof (v)); - finalx = mthingx + v[0]; - finaly = mthingy + v[1]; - finalz = mthingz + v[2]; + finalx = x + v[0]; + finaly = y + v[1]; + finalz = z + v[2]; mobj = P_SpawnMobj(finalx, finaly, finalz, MT_HOOPCOLLIDE); mobj->z -= mobj->height/2; @@ -9052,12 +9120,13 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) // Wing logo item. else if (mthing->type == mobjinfo[MT_NIGHTSWING].doomednum) { + z = sec->floorheight; if (mthing->options >> ZSHIFT) - mthing->z = (INT16)((R_PointInSubsector(x, y)->sector->floorheight + ((mthing->options >> ZSHIFT) << FRACBITS))>>FRACBITS); - else - mthing->z = (INT16)(R_PointInSubsector(mthing->x << FRACBITS, mthing->y << FRACBITS)->sector->floorheight>>FRACBITS); + z += ((mthing->options >> ZSHIFT) << FRACBITS); - mobj = P_SpawnMobj(mthing->x << FRACBITS, mthing->y << FRACBITS,mthing->z << FRACBITS, MT_NIGHTSWING); + mthing->z = (INT16)(z>>FRACBITS); + + mobj = P_SpawnMobj(x, y, z, MT_NIGHTSWING); mobj->spawnpoint = mthing; if (G_IsSpecialStage(gamemap) && useNightsSS) @@ -9076,7 +9145,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) mobjtype_t ringthing = MT_RING; // No rings in Ultimate! - if (ultimatemode && !(G_IsSpecialStage(gamemap) || (maptol & TOL_NIGHTS))) + if (ultimatemode && !(G_IsSpecialStage(gamemap) || maptol & TOL_NIGHTS)) return; // Which ringthing to use @@ -9101,30 +9170,30 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) } // Set proper height - if (mthing->options >> ZSHIFT) + if (mthing->options & MTF_OBJECTFLIP) { - if (!(mthing->options & MTF_OBJECTFLIP)) - mthing->z = (INT16)((R_PointInSubsector(mthing->x << FRACBITS, mthing->y << FRACBITS)->sector->floorheight + ((mthing->options >> ZSHIFT) << FRACBITS))>>FRACBITS); - else - mthing->z = (INT16)((R_PointInSubsector(mthing->x << FRACBITS, mthing->y << FRACBITS)->sector->ceilingheight - mobjinfo[ringthing].height - ((mthing->options >> ZSHIFT) << FRACBITS))>>FRACBITS); + z = sec->ceilingheight - mobjinfo[ringthing].height; + if (mthing->options >> ZSHIFT) + z -= ((mthing->options >> ZSHIFT) << FRACBITS); } else { - if (!(mthing->options & MTF_OBJECTFLIP)) - mthing->z = (INT16)(R_PointInSubsector(mthing->x << FRACBITS, mthing->y << FRACBITS)->sector->floorheight>>FRACBITS); - else - mthing->z = (INT16)((R_PointInSubsector(mthing->x << FRACBITS, mthing->y << FRACBITS)->sector->ceilingheight - mobjinfo[ringthing].height)>>FRACBITS); + z = sec->floorheight; + if (mthing->options >> ZSHIFT) + z += ((mthing->options >> ZSHIFT) << FRACBITS); } if (mthing->options & MTF_AMBUSH) // Special flag for rings { - if (!(mthing->options & MTF_OBJECTFLIP)) - mthing->z += 24; + if (mthing->options & MTF_OBJECTFLIP) + z -= 24*FRACUNIT; else - mthing->z -= 24; + z += 24*FRACUNIT; } - mobj = P_SpawnMobj(mthing->x << FRACBITS, mthing->y << FRACBITS,mthing->z << FRACBITS, ringthing); + mthing->z = (INT16)(z>>FRACBITS); + + mobj = P_SpawnMobj(x, y, z, ringthing); mobj->spawnpoint = mthing; if (mthing->options & MTF_OBJECTFLIP) @@ -9150,7 +9219,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) dist = 128*FRACUNIT; // No rings in Ultimate! - if (ultimatemode && !(G_IsSpecialStage(gamemap) || (maptol & TOL_NIGHTS))) + if (ultimatemode && !(G_IsSpecialStage(gamemap) || maptol & TOL_NIGHTS)) return; #ifdef BLUE_SPHERES @@ -9161,19 +9230,17 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) for (r = 1; r <= 5; r++) { - if (mthing->options >> ZSHIFT) + if (mthing->options & MTF_OBJECTFLIP) { - if (!(mthing->options & MTF_OBJECTFLIP)) - z = (R_PointInSubsector(mthing->x << FRACBITS, mthing->y << FRACBITS)->sector->floorheight + ((mthing->options >> ZSHIFT) << FRACBITS)) + dist*r; - else - z = (R_PointInSubsector(mthing->x << FRACBITS, mthing->y << FRACBITS)->sector->ceilingheight - mobjinfo[ringthing].height - ((mthing->options >> ZSHIFT) << FRACBITS)) - dist*r; + z = sec->ceilingheight - mobjinfo[ringthing].height - dist*r; + if (mthing->options >> ZSHIFT) + z -= ((mthing->options >> ZSHIFT) << FRACBITS); } else { - if (!(mthing->options & MTF_OBJECTFLIP)) - z = R_PointInSubsector(mthing->x << FRACBITS, mthing->y << FRACBITS)->sector->floorheight + dist*r; - else - z = R_PointInSubsector(mthing->x << FRACBITS, mthing->y << FRACBITS)->sector->ceilingheight - mobjinfo[ringthing].height - dist*r; + z = sec->floorheight + dist*r; + if (mthing->options >> ZSHIFT) + z += ((mthing->options >> ZSHIFT) << FRACBITS); } mobj = P_SpawnMobj(x, y, z, ringthing); @@ -9199,7 +9266,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) iterations = 10; // No rings in Ultimate! - if (ultimatemode && !(G_IsSpecialStage(gamemap) || (maptol & TOL_NIGHTS))) + if (ultimatemode && !(G_IsSpecialStage(gamemap) || maptol & TOL_NIGHTS)) return; #ifdef BLUE_SPHERES @@ -9215,19 +9282,17 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) x += FixedMul(64*FRACUNIT, FINECOSINE(angle)); y += FixedMul(64*FRACUNIT, FINESINE(angle)); - if (mthing->options >> ZSHIFT) + if (mthing->options & MTF_OBJECTFLIP) { - if (!(mthing->options & MTF_OBJECTFLIP)) - z = (R_PointInSubsector(mthing->x << FRACBITS, mthing->y << FRACBITS)->sector->floorheight + ((mthing->options >> ZSHIFT) << FRACBITS)) + 64*FRACUNIT*r; - else - z = (R_PointInSubsector(mthing->x << FRACBITS, mthing->y << FRACBITS)->sector->ceilingheight - mobjinfo[ringthing].height - ((mthing->options >> ZSHIFT) << FRACBITS)) - 64*FRACUNIT*r; + z = sec->ceilingheight - mobjinfo[ringthing].height - 64*FRACUNIT*r; + if (mthing->options >> ZSHIFT) + z -= ((mthing->options >> ZSHIFT) << FRACBITS); } else { - if (!(mthing->options & MTF_OBJECTFLIP)) - z = R_PointInSubsector(mthing->x << FRACBITS, mthing->y << FRACBITS)->sector->floorheight + 64*FRACUNIT*r; - else - z = R_PointInSubsector(mthing->x << FRACBITS, mthing->y << FRACBITS)->sector->ceilingheight - mobjinfo[ringthing].height - 64*FRACUNIT*r; + z = sec->floorheight + 64*FRACUNIT*r; + if (mthing->options >> ZSHIFT) + z += ((mthing->options >> ZSHIFT) << FRACBITS); } mobj = P_SpawnMobj(x, y, z, ringthing); @@ -9256,13 +9321,9 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) size = 192*FRACUNIT; } - mthingx = mthing->x << FRACBITS; - mthingy = mthing->y << FRACBITS; - + z = sec->floorheight; if (mthing->options >> ZSHIFT) - mthingz = (R_PointInSubsector(x, y)->sector->floorheight + ((mthing->options >> ZSHIFT) << FRACBITS)); - else - mthingz = R_PointInSubsector(mthingx, mthingy)->sector->floorheight; + z += ((mthing->options >> ZSHIFT) << FRACBITS); closestangle = FixedAngle(mthing->angle*FRACUNIT); @@ -9309,9 +9370,9 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) res = VectorMatrixMultiply(v, *RotateZMatrix(closestangle)); M_Memcpy(&v, res, sizeof (v)); - finalx = mthingx + v[0]; - finaly = mthingy + v[1]; - finalz = mthingz + v[2]; + finalx = x + v[0]; + finaly = y + v[1]; + finalz = z + v[2]; mobj = P_SpawnMobj(finalx, finaly, finalz, itemToSpawn); mobj->z -= mobj->height/2; @@ -9451,7 +9512,7 @@ mobj_t *P_SpawnAlteredDirectionMissile(mobj_t *source, mobjtype_t type, fixed_t S_StartSound(th, th->info->seesound); P_SetTarget(&th->target, source->target); // where it came from - an = R_PointToAngle2(x, y, x+source->momx*16, y+source->momy*16) + (ANG1*shiftingAngle); + an = R_PointToAngle2(0, 0, source->momx, source->momy) + (ANG1*shiftingAngle); th->angle = an; an >>= ANGLETOFINESHIFT; diff --git a/src/p_saveg.c b/src/p_saveg.c index 462e68afe..3392d1e24 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -120,14 +120,8 @@ static inline void P_NetArchivePlayers(void) flags = 0; - // ticcmd write - WRITESINT8(save_p, players[i].cmd.forwardmove); - WRITESINT8(save_p, players[i].cmd.sidemove); - WRITEINT16(save_p, players[i].cmd.angleturn); - WRITEINT16(save_p, players[i].cmd.aiming); - WRITEUINT16(save_p, players[i].cmd.buttons); + // no longer send ticcmds, player name, skin, or color - WRITESTRINGN(save_p, player_names[i], MAXPLAYERNAME); WRITEANGLE(save_p, players[i].aiming); WRITEANGLE(save_p, players[i].awayviewaiming); WRITEINT32(save_p, players[i].awayviewtics); @@ -148,8 +142,6 @@ static inline void P_NetArchivePlayers(void) WRITEUINT16(save_p, players[i].flashpal); WRITEUINT16(save_p, players[i].flashcount); - WRITEUINT8(save_p, players[i].skincolor); - WRITEINT32(save_p, players[i].skin); WRITEUINT32(save_p, players[i].score); WRITEINT32(save_p, players[i].dashspeed); WRITEINT32(save_p, players[i].dashtime); @@ -289,26 +281,22 @@ static inline void P_NetUnArchivePlayers(void) { INT32 i, j; UINT16 flags; - ticcmd_t tmptic; if (READUINT32(save_p) != ARCHIVEBLOCK_PLAYERS) I_Error("Bad $$$.sav at archive block Players"); for (i = 0; i < MAXPLAYERS; i++) { - memset(&players[i], 0, sizeof (player_t)); + // Do NOT memset player struct to 0 + // other areas may initialize data elsewhere + //memset(&players[i], 0, sizeof (player_t)); if (!playeringame[i]) continue; - memset(&tmptic, 0, sizeof(ticcmd_t)); - tmptic.forwardmove = READSINT8(save_p); - tmptic.sidemove = READSINT8(save_p); - tmptic.angleturn = READINT16(save_p); - tmptic.aiming = READINT16(save_p); - tmptic.buttons = READUINT16(save_p); - G_CopyTiccmd(&players[i].cmd, &tmptic, 1); + // NOTE: sending tics should (hopefully) no longer be necessary + // sending player names, skin and color should not be necessary at all! + // (that data is handled in the server config now) - READSTRINGN(save_p, player_names[i], MAXPLAYERNAME); players[i].aiming = READANGLE(save_p); players[i].awayviewaiming = READANGLE(save_p); players[i].awayviewtics = READINT32(save_p); @@ -329,8 +317,6 @@ static inline void P_NetUnArchivePlayers(void) players[i].flashpal = READUINT16(save_p); players[i].flashcount = READUINT16(save_p); - players[i].skincolor = READUINT8(save_p); - players[i].skin = READINT32(save_p); players[i].score = READUINT32(save_p); players[i].dashspeed = READINT32(save_p); // dashing speed players[i].dashtime = READINT32(save_p); // dashing speed diff --git a/src/p_setup.c b/src/p_setup.c index c5b6995e4..bd2b0a478 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -220,6 +220,10 @@ static void P_ClearSingleMapHeaderInfo(INT16 i) mapheaderinfo[num]->menuflags = 0; // TODO grades support for delfile (pfft yeah right) P_DeleteGrades(num); + // an even further impossibility, delfile custom opts support + mapheaderinfo[num]->customopts = NULL; + mapheaderinfo[num]->numCustomOptions = 0; + DEH_WriteUndoline(va("# uload for map %d", i), NULL, UNDO_DONE); } @@ -678,6 +682,7 @@ static void P_LoadSectors(lumpnum_t lumpnum) ss->lines = NULL; ss->heightsec = -1; + ss->camsec = -1; ss->floorlightsec = -1; ss->ceilinglightsec = -1; ss->crumblestate = 0; @@ -2559,6 +2564,15 @@ noscript: } #endif + // oh god I hope this helps + // (addendum: apparently it does! + // none of this needs to be done because it's not the beginning of the map when + // a netgame save is being loaded, and could actively be harmful by messing with + // the client's view of the data.) + if (fromnetsave) + goto netgameskip; + // ========== + for (i = 0; i < MAXPLAYERS; i++) if (playeringame[i]) { @@ -2694,6 +2708,10 @@ noscript: else if (gametype == GT_RACE && server && cv_usemapnumlaps.value) CV_StealthSetValue(&cv_numlaps, mapheaderinfo[gamemap - 1]->numlaps); + // =========== + // landing point for netgames. + netgameskip: + if (!dedicated) { if (players[displayplayer].mo && (server || addedtogame)) @@ -2769,7 +2787,6 @@ noscript: if (twodlevel) { - CV_SetValue(&cv_cam_dist, 320); CV_SetValue(&cv_analog2, false); CV_SetValue(&cv_analog, false); } diff --git a/src/p_spec.c b/src/p_spec.c index fa6200cd5..c29e47fa2 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1536,6 +1536,337 @@ static void P_AddExecutorDelay(line_t *line, mobj_t *mobj) static sector_t *triplinecaller; +/** 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) +{ + sector_t *ctlsector; + fixed_t dist = P_AproxDistance(triggerline->dx, triggerline->dy)>>FRACBITS; + size_t i, linecnt, sectori; + INT16 specialtype = triggerline->special; + + ///////////////////////////////////////////////// + // Distance-checking/sector trigger conditions // + ///////////////////////////////////////////////// + + // Linetypes 303 and 304 require a specific + // number, or minimum or maximum, of rings. + if (specialtype == 303 || specialtype == 304) + { + 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 || players[i].mo->health < 1) + continue; + + rings += players[i].mo->health-1; + } + } + else + { + if (!(actor && actor->player)) + return false; // no player to count rings from here, sorry + + rings = actor->health-1; + } + + 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) + numpush++; + node = node->m_snext; + } + + 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 > 320)) + { + 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; + default: + break; + } + + ///////////////////////////////// + // Processing linedef specials // + ///////////////////////////////// + + triplinecaller = caller; + ctlsector = triggerline->frontsector; + sectori = (size_t)(ctlsector - sectors); + linecnt = ctlsector->linecount; + + if (triggerline->flags & ML_EFFECT5) // 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]->flags & ML_DONTPEGTOP) + P_AddExecutorDelay(ctlsector->lines[i], actor); + else + P_ProcessLineSpecial(ctlsector->lines[i], actor); + } + } + else // walk around the sector in a defined order + { + boolean backwards = false; + size_t j, masterlineindex = (size_t)-1; + + for (i = 0; i < linecnt; i++) + if (ctlsector->lines[i] == triggerline) + { + masterlineindex = i; + break; + } + +#ifdef PARANOIA + if (masterlineindex == (size_t)-1) + { + const size_t li = (size_t)(ctlsector->lines[i] - lines); + I_Error("Line %s isn't linked into its front sector", sizeu1(li)); + } +#endif + + // i == masterlineindex + for (;;) + { + if (backwards) // v2 to v1 + { + for (j = 0; j < linecnt; j++) + { + if (i == j) + continue; + if (ctlsector->lines[i]->v1 == ctlsector->lines[j]->v2) + { + i = j; + break; + } + if (ctlsector->lines[i]->v1 == ctlsector->lines[j]->v1) + { + i = j; + backwards = false; + break; + } + } + if (j == linecnt) + { + const size_t vertexei = (size_t)(ctlsector->lines[i]->v1 - vertexes); + CONS_Debug(DBG_GAMELOGIC, "Warning: Sector %s is not closed at vertex %s (%d, %d)\n", + sizeu1(sectori), sizeu2(vertexei), ctlsector->lines[i]->v1->x, ctlsector->lines[i]->v1->y); + return false; // abort + } + } + else // v1 to v2 + { + for (j = 0; j < linecnt; j++) + { + if (i == j) + continue; + if (ctlsector->lines[i]->v2 == ctlsector->lines[j]->v1) + { + i = j; + break; + } + if (ctlsector->lines[i]->v2 == ctlsector->lines[j]->v2) + { + i = j; + backwards = true; + break; + } + } + if (j == linecnt) + { + const size_t vertexei = (size_t)(ctlsector->lines[i]->v1 - vertexes); + CONS_Debug(DBG_GAMELOGIC, "Warning: Sector %s is not closed at vertex %s (%d, %d)\n", + sizeu1(sectori), sizeu2(vertexei), ctlsector->lines[i]->v2->x, ctlsector->lines[i]->v2->y); + return false; // abort + } + } + + if (i == masterlineindex) + break; + + if (ctlsector->lines[i]->special >= 400 + && ctlsector->lines[i]->special < 500) + { + if (ctlsector->lines[i]->flags & ML_DONTPEGTOP) + P_AddExecutorDelay(ctlsector->lines[i], actor); + else + P_ProcessLineSpecial(ctlsector->lines[i], actor); + } + } + } + + // Special type 308, 307, 302, 304, 315, 318, and 320 only work once + if (specialtype == 302 || specialtype == 304 || specialtype == 307 || specialtype == 308 || specialtype == 315 || specialtype == 318 || specialtype == 320) + { + triggerline->special = 0; // Clear it out + + // Hmm, I'm thinking that we shouldn't touch the sector special, incase + // we have continuous executors associated with it, too? + /* + if (caller && (GETSECSPECIAL(caller->special, 2) >= 1 && GETSECSPECIAL(caller->special, 2) <= 7)) + caller->special = (UINT16)(caller->special-(GETSECSPECIAL(caller->special, 2) << 4)); // Only remove the relevant section + */ + } + return true; +} + /** Runs a linedef executor. * Can be called by: * - a player moving into a special sector or FOF. @@ -1546,15 +1877,12 @@ static sector_t *triplinecaller; * \param tag Tag of the linedef executor to run. * \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 + * \sa P_ProcessLineSpecial, P_RunTriggerLinedef * \author Graue */ void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller) { - sector_t *ctlsector; - fixed_t dist; - size_t masterline, i, linecnt, sectori; - INT16 specialtype; + size_t masterline; CONS_Debug(DBG_GAMELOGIC, "P_LinedefExecute: Executing trigger linedefs of tag %d\n", tag); @@ -1578,289 +1906,8 @@ void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller) || lines[masterline].special > 399) continue; - specialtype = lines[masterline].special; - - // Special handling for some executors - - // Linetypes 303 and 304 require a specific - // number, or minimum or maximum, of rings. - if (actor && actor->player && (specialtype == 303 - || specialtype == 304)) - { - fixed_t rings = 0; - - // With the passuse flag, count all player's - // rings. - if (lines[masterline].flags & ML_EFFECT4) - { - for (i = 0; i < MAXPLAYERS; i++) - { - if (!playeringame[i] || players[i].spectator) - continue; - - if (!players[i].mo || players[i].mo->health < 1) - continue; - - rings += players[i].mo->health-1; - } - } - else - rings = actor->health-1; - - dist = P_AproxDistance(lines[masterline].dx, lines[masterline].dy)>>FRACBITS; - - if (lines[masterline].flags & ML_NOCLIMB) - { - if (rings > dist) - return; - } - else if (lines[masterline].flags & ML_BLOCKMONSTERS) - { - if (rings < dist) - return; - } - else - { - if (rings != dist) - return; - } - } - else if (caller) - { - if (GETSECSPECIAL(caller->special, 2) == 6) - { - if (!(ALL7EMERALDS(emeralds))) - return; - } - else if (GETSECSPECIAL(caller->special, 2) == 7) - { - UINT8 mare; - - if (!(maptol & TOL_NIGHTS)) - return; - - dist = P_AproxDistance(lines[masterline].dx, lines[masterline].dy)>>FRACBITS; - mare = P_FindLowestMare(); - - if (lines[masterline].flags & ML_NOCLIMB) - { - if (!(mare <= dist)) - return; - } - else if (lines[masterline].flags & ML_BLOCKMONSTERS) - { - if (!(mare >= dist)) - return; - } - else - { - if (!(mare == dist)) - return; - } - } - // 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 > 318)) - { - 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); - } - - - if (specialtype >= 314 && specialtype <= 315) - { - msecnode_t *node; - mobj_t *mo; - INT32 numpush = 0; - INT32 numneeded = P_AproxDistance(lines[masterline].dx, lines[masterline].dy)>>FRACBITS; - - // 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) - numpush++; - node = node->m_snext; - } - - if (lines[masterline].flags & ML_NOCLIMB) // Need at least or more - { - if (numpush < numneeded) - return; - } - else if (lines[masterline].flags & ML_EFFECT4) // Need less than - { - if (numpush >= numneeded) - return; - } - else // Need exact - { - if (numpush != numneeded) - return; - } - } - } - - if (specialtype >= 305 && specialtype <= 307) - { - if (!actor) - return; - - if (!actor->player) - return; - - if (actor->player->charability != (P_AproxDistance(lines[masterline].dx, lines[masterline].dy)>>FRACBITS)/10) - return; - } - - // Only red team members can activate this. - if ((specialtype == 309 || specialtype == 310) - && !(actor && actor->player && actor->player->ctfteam == 1)) - return; - - // Only blue team members can activate this. - if ((specialtype == 311 || specialtype == 312) - && !(actor && actor->player && actor->player->ctfteam == 2)) - return; - - // Unlockable triggers required - if (specialtype <= 318 && specialtype >= 317) - { - INT32 trigid = (INT32)(sides[lines[masterline].sidenum[0]].textureoffset>>FRACBITS); - - if ((modifiedgame && !savemoddata) || (netgame || multiplayer)) - return; - else if (trigid < 0 || trigid > 31) // limited by 32 bit variable - { - CONS_Debug(DBG_GAMELOGIC, "Unlockable trigger (sidedef %hu): bad trigger ID %d\n", lines[masterline].sidenum[0], trigid); - return; - } - else if (!(unlocktriggers & (1 << trigid))) - return; - } - - triplinecaller = caller; - ctlsector = lines[masterline].frontsector; - sectori = (size_t)(ctlsector - sectors); - linecnt = ctlsector->linecount; - - if (lines[masterline].flags & ML_EFFECT5) // 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]->flags & ML_DONTPEGTOP) - P_AddExecutorDelay(ctlsector->lines[i], actor); - else - P_ProcessLineSpecial(ctlsector->lines[i], actor); - } - } - else // walk around the sector in a defined order - { - boolean backwards = false; - size_t j, masterlineindex = (size_t)-1; - - for (i = 0; i < linecnt; i++) - if (ctlsector->lines[i] == &lines[masterline]) - { - masterlineindex = i; - break; - } - -#ifdef PARANOIA - if (masterlineindex == (size_t)-1) - { - const size_t li = (size_t)(ctlsector->lines[i] - lines); - I_Error("Line %s isn't linked into its front sector", sizeu1(li)); - } -#endif - - // i == masterlineindex - for (;;) - { - if (backwards) // v2 to v1 - { - for (j = 0; j < linecnt; j++) - { - if (i == j) - continue; - if (ctlsector->lines[i]->v1 == ctlsector->lines[j]->v2) - { - i = j; - break; - } - if (ctlsector->lines[i]->v1 == ctlsector->lines[j]->v1) - { - i = j; - backwards = false; - break; - } - } - if (j == linecnt) - { - const size_t vertexei = (size_t)(ctlsector->lines[i]->v1 - vertexes); - CONS_Debug(DBG_GAMELOGIC, "Warning: Sector %s is not closed at vertex %s (%d, %d)\n", - sizeu1(sectori), sizeu2(vertexei), ctlsector->lines[i]->v1->x, ctlsector->lines[i]->v1->y); - return; // abort - } - } - else // v1 to v2 - { - for (j = 0; j < linecnt; j++) - { - if (i == j) - continue; - if (ctlsector->lines[i]->v2 == ctlsector->lines[j]->v1) - { - i = j; - break; - } - if (ctlsector->lines[i]->v2 == ctlsector->lines[j]->v2) - { - i = j; - backwards = true; - break; - } - } - if (j == linecnt) - { - const size_t vertexei = (size_t)(ctlsector->lines[i]->v1 - vertexes); - CONS_Debug(DBG_GAMELOGIC, "Warning: Sector %s is not closed at vertex %s (%d, %d)\n", - sizeu1(sectori), sizeu2(vertexei), ctlsector->lines[i]->v2->x, ctlsector->lines[i]->v2->y); - return; // abort - } - } - - if (i == masterlineindex) - break; - - if (ctlsector->lines[i]->special >= 400 - && ctlsector->lines[i]->special < 500) - { - if (ctlsector->lines[i]->flags & ML_DONTPEGTOP) - P_AddExecutorDelay(ctlsector->lines[i], actor); - else - P_ProcessLineSpecial(ctlsector->lines[i], actor); - } - } - } - - // Special type 308, 307, 302, 304, 315, and 318 only work once - if (specialtype == 302 || specialtype == 304 || specialtype == 307 || specialtype == 308 || specialtype == 315 || specialtype == 318) - { - lines[masterline].special = 0; // Clear it out - - // Hmm, I'm thinking that we shouldn't touch the sector special, incase - // we have continuous executors associated with it, too? - /* - if (caller && (GETSECSPECIAL(caller->special, 2) >= 1 && GETSECSPECIAL(caller->special, 2) <= 7)) - caller->special = (UINT16)(caller->special-(GETSECSPECIAL(caller->special, 2) << 4)); // Only remove the relevant section - */ - } + if (!P_RunTriggerLinedef(&lines[masterline], actor, caller)) + return; // cancel P_LinedefExecute if function returns false } } @@ -2201,21 +2248,15 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo) break;*/ case 409: // Change tagged sectors' tag - // (formerly "Change calling sectors' tag", but behavior - // was changed) + // (formerly "Change calling sectors' tag", but behavior was changed) { - while ((secnum = P_FindSectorFromLineTag(line, - secnum)) != -1) - { - P_ChangeSectorTag(secnum, - (INT16)(P_AproxDistance(line->dx, line->dy) - >>FRACBITS)); - } + while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0) + P_ChangeSectorTag(secnum,(INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS)); break; } case 410: // Change front sector's tag - P_ChangeSectorTag((UINT32)(line->frontsector - sectors), (INT16)(P_AproxDistance(line->dx, line->dy)>>FRACBITS)); + P_ChangeSectorTag((UINT32)(line->frontsector - sectors), (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS)); break; case 411: // Stop floor/ceiling movement in tagged sector(s) @@ -3109,7 +3150,7 @@ void P_SetupSignExit(player_t *player) // // Checks to see if a flag is at its base. // -static boolean P_IsFlagAtBase(mobjtype_t flag) +boolean P_IsFlagAtBase(mobjtype_t flag) { thinker_t *think; mobj_t *mo; @@ -3388,14 +3429,14 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers P_DoPlayerPain(player, NULL, NULL); // this does basically everything that was here before - if (gametype == GT_CTF && (player->gotflag & GF_REDFLAG || player->gotflag & GF_BLUEFLAG)) + if (gametype == GT_CTF && player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)) P_PlayerFlagBurst(player, false); break; case 12: // Space Countdown if ((player->powers[pw_shield] & SH_NOSTACK) != SH_ELEMENTAL && !player->powers[pw_spacetime]) player->powers[pw_spacetime] = spacetimetics + 1; break; - case 13: // Ramp Sector (Increase step-up) + 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; @@ -4056,8 +4097,7 @@ DoneSection2: junk.dx = v2.x - v1.x; junk.dy = v2.y - v1.y; - P_ClosestPointOnLine(player->mo->x, player->mo->y, &junk, &resultlow); - resultlow.z = waypointmid->z; + P_ClosestPointOnLine3D(player->mo->x, player->mo->y, player->mo->z, &junk, &resultlow); } // Waypointmid and Waypointhigh: @@ -4074,11 +4114,10 @@ DoneSection2: junk.dx = v2.x - v1.x; junk.dy = v2.y - v1.y; - P_ClosestPointOnLine(player->mo->x, player->mo->y, &junk, &resulthigh); - resulthigh.z = waypointhigh->z; + P_ClosestPointOnLine3D(player->mo->x, player->mo->y, player->mo->z, &junk, &resulthigh); } - // 3D support not available yet. Need a 3D version of P_ClosestPointOnLine. + // 3D support now available. Disregard the previous notice here. -Red P_UnsetThingPosition(player->mo); P_ResetPlayer(player); @@ -4086,23 +4125,24 @@ DoneSection2: if (lines[lineindex].flags & ML_EFFECT1) // Don't wrap { - if (waypointhigh) - { - closest = waypointhigh; - player->mo->x = resulthigh.x; - player->mo->y = resulthigh.y; - player->mo->z = resulthigh.z - P_GetPlayerHeight(player); - } - else if (waypointlow) - { - closest = waypointmid; - player->mo->x = resultlow.x; - player->mo->y = resultlow.y; - player->mo->z = resultlow.z - P_GetPlayerHeight(player); - } - 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 == highest->health) + { + 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), @@ -5528,6 +5568,9 @@ void P_SpawnSpecials(INT32 fromnetsave) if (lines[i].flags & ML_EFFECT3) sectors[s].flags |= SF_TRIGGERSPECIAL_TOUCH; + + if (lines[i].frontsector && GETSECSPECIAL(lines[i].frontsector->special, 4) == 12) + sectors[s].camsec = sides[*lines[i].sidenum].sector-sectors; } break; @@ -6175,6 +6218,9 @@ void P_SpawnSpecials(INT32 fromnetsave) case 317: case 318: break; + case 319: + case 320: + break; case 399: // Linedef execute on map load // This is handled in P_RunLevelLoadExecutors. @@ -6588,7 +6634,7 @@ void T_Scroll(scroll_t *s) continue; if (!((thing = node->m_thing)->flags & MF_NOCLIP) && - (!(thing->flags & MF_NOGRAVITY || thing->z < height))) + (!(thing->flags & MF_NOGRAVITY || thing->z+thing->height < height))) { // Move objects only if on floor or underwater, // non-floating, and clipped. diff --git a/src/p_spec.h b/src/p_spec.h index 191d8eae0..04152f68d 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -56,9 +56,11 @@ INT32 P_FindSpecialLineFromTag(INT16 special, INT16 tag, INT32 start); INT32 P_FindMinSurroundingLight(sector_t *sector, INT32 max); void P_SetupSignExit(player_t *player); +boolean P_IsFlagAtBase(mobjtype_t flag); void P_SwitchWeather(INT32 weathernum); +boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller); void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller); void P_ChangeSectorTag(UINT32 sector, INT16 newtag); diff --git a/src/p_user.c b/src/p_user.c index 05c1595cb..5c8f2d91f 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -37,6 +37,7 @@ // We need to affect the NiGHTS hud #include "st_stuff.h" #include "lua_script.h" +#include "lua_hook.h" #include "b_bot.h" // Objectplace #include "m_cheat.h" @@ -597,21 +598,6 @@ static void P_DeNightserizePlayer(player_t *player) player->mo->flags2 &= ~MF2_DONTDRAW; - if (splitscreen && player == &players[secondarydisplayplayer]) - { - if (cv_analog2.value) - CV_SetValue(&cv_cam2_dist, 192); - else - CV_SetValue(&cv_cam2_dist, atoi(cv_cam2_dist.defaultvalue)); - } - else if (player == &players[displayplayer]) - { - if (cv_analog.value) - CV_SetValue(&cv_cam_dist, 192); - else - CV_SetValue(&cv_cam_dist, atoi(cv_cam_dist.defaultvalue)); - } - // Restore aiming angle if (player == &players[consoleplayer]) localaiming = 0; @@ -668,6 +654,14 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) if (player->bot) return; + if (!(player->pflags & PF_NIGHTSMODE)) + { + P_SetTarget(&player->mo->tracer, P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_NIGHTSCHAR)); + player->mo->tracer->destscale = player->mo->scale; + P_SetScale(player->mo->tracer, player->mo->scale); + player->mo->tracer->eflags = (player->mo->tracer->eflags & ~MFE_VERTICALFLIP)|(player->mo->eflags & MFE_VERTICALFLIP); + } + player->pflags &= ~(PF_USEDOWN|PF_JUMPDOWN|PF_ATTACKDOWN|PF_STARTDASH|PF_GLIDING|PF_JUMPED|PF_THOKKED|PF_SPINNING|PF_DRILLING); player->homing = 0; player->mo->fuse = 0; @@ -681,11 +675,6 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) player->mo->flags2 |= MF2_DONTDRAW; - if (splitscreen && player == &players[secondarydisplayplayer]) - CV_SetValue(&cv_cam2_dist, 320); - else if (player == &players[displayplayer]) - CV_SetValue(&cv_cam_dist, 320); - player->nightstime = player->startedtime = nighttime*TICRATE; player->bonustime = false; @@ -853,7 +842,7 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor) } else { - ang = R_PointToAngle2(player->mo->x + player->mo->momx, player->mo->y + player->mo->momy, player->mo->x, player->mo->y); + ang = R_PointToAngle2(player->mo->momx, player->mo->momy, 0, 0); fallbackspeed = FixedMul(4*FRACUNIT, player->mo->scale); } @@ -1149,6 +1138,23 @@ void P_RestoreMusic(player_t *player) S_ChangeMusic(mapmusic, true); } +// +// P_IsObjectInGoop +// +// Returns true if the object is inside goop water. +// (Spectators and objects otherwise without gravity cannot have goop gravity!) +// +boolean P_IsObjectInGoop(mobj_t *mo) +{ + if (mo->player && mo->player->spectator) + return false; + + if (mo->flags & MF_NOGRAVITY) + return false; + + return ((mo->eflags & (MFE_UNDERWATER|MFE_GOOWATER)) == (MFE_UNDERWATER|MFE_GOOWATER)); +} + // // P_IsObjectOnGround // @@ -1158,8 +1164,9 @@ void P_RestoreMusic(player_t *player) // boolean P_IsObjectOnGround(mobj_t *mo) { - if ((mo->eflags & (MFE_UNDERWATER|MFE_GOOWATER)) == (MFE_UNDERWATER|MFE_GOOWATER) && !(mo->player && mo->player->spectator)) + if (P_IsObjectInGoop(mo)) { +/* // It's a crazy hack that checking if you're on the ground // would actually CHANGE your position and momentum, if (mo->z < mo->floorz) @@ -1172,6 +1179,7 @@ boolean P_IsObjectOnGround(mobj_t *mo) mo->z = mo->ceilingz - mo->height; mo->momz = 0; } +*/ // but I don't want you to ever 'stand' while submerged in goo. // You're in constant vertical momentum, even if you get stuck on something. // No exceptions. @@ -1401,6 +1409,18 @@ void P_SpawnShieldOrb(player_t *player) P_SetTarget(&ov->target, shieldobj); P_SetMobjState(ov, shieldobj->info->missilestate); } + if (player->powers[pw_shield] & SH_FORCE) + { + //Copy and pasted from P_ShieldLook in p_mobj.c + shieldobj->movecount = (player->powers[pw_shield] & 0xFF); + if (shieldobj->movecount < 1) + { + if (shieldobj->info->painstate) + P_SetMobjState(shieldobj,shieldobj->info->painstate); + else + shieldobj->flags2 |= MF2_SHADOW; + } + } } // @@ -1445,7 +1465,7 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj) // // Spawns the appropriate thok object on the player // -static void P_SpawnThokMobj(player_t *player) +void P_SpawnThokMobj(player_t *player) { mobj_t *mobj; mobjtype_t type = player->thokitem; @@ -1500,7 +1520,7 @@ static void P_SpawnThokMobj(player_t *player) // // Spawns the appropriate spin object on the player // -static void P_SpawnSpinMobj(player_t *player, mobjtype_t type) +void P_SpawnSpinMobj(player_t *player, mobjtype_t type) { mobj_t *mobj; fixed_t zheight; @@ -1574,8 +1594,13 @@ void P_DoPlayerExit(player_t *player) else player->exiting = (14*TICRATE)/5 + 2; // Accidental death safeguard??? - player->pflags &= ~PF_GLIDING; - player->climbing = 0; + //player->pflags &= ~PF_GLIDING; + if (player->climbing) + { + player->climbing = 0; + player->pflags |= PF_JUMPED; + P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); + } player->powers[pw_underwater] = 0; player->powers[pw_spacetime] = 0; P_RestoreMusic(player); @@ -1585,7 +1610,7 @@ void P_DoPlayerExit(player_t *player) } #define SPACESPECIAL 12 -static boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space +boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space { sector_t *sector; @@ -1616,7 +1641,7 @@ static boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space return false; // No vacuum here, Captain! } -static boolean P_InQuicksand(mobj_t *mo) // Returns true if you are in quicksand +boolean P_InQuicksand(mobj_t *mo) // Returns true if you are in quicksand { sector_t *sector; @@ -2049,46 +2074,39 @@ static void P_CheckUnderwaterAndSpaceTimer(player_t *player) // static void P_CheckInvincibilityTimer(player_t *player) { - ticcmd_t *cmd = &player->cmd; - if (mariomode && player->powers[pw_invulnerability] && !player->powers[pw_super]) - player->mo->color = (UINT8)(leveltime % MAXSKINCOLORS); - else + if (!player->powers[pw_invulnerability]) + return; + + if (mariomode && !player->powers[pw_super]) + player->mo->color = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1))); + else if (leveltime % (TICRATE/7) == 0) { - if (player->powers[pw_invulnerability] && leveltime % (TICRATE/7) == 0) + fixed_t destx, desty; + mobj_t *sparkle; + + if (!splitscreen && rendermode != render_soft) { - fixed_t destx, desty; - mobj_t *sparkle; + angle_t viewingangle; - if (!splitscreen && rendermode != render_soft) - { - angle_t viewingangle; - - if (players[displayplayer].awayviewtics) - viewingangle = R_PointToAngle2(player->mo->x, player->mo->y, players[displayplayer].awayviewmobj->x, players[displayplayer].awayviewmobj->y); - else if (!camera.chase && players[displayplayer].mo) - viewingangle = R_PointToAngle2(player->mo->x, player->mo->y, players[displayplayer].mo->x, players[displayplayer].mo->y); - else - viewingangle = R_PointToAngle2(player->mo->x, player->mo->y, camera.x, camera.y); - - destx = player->mo->x + P_ReturnThrustX(player->mo, viewingangle, FixedMul(FRACUNIT, player->mo->scale)); - desty = player->mo->y + P_ReturnThrustY(player->mo, viewingangle, FixedMul(FRACUNIT, player->mo->scale)); - } + if (players[displayplayer].awayviewtics) + viewingangle = R_PointToAngle2(player->mo->x, player->mo->y, players[displayplayer].awayviewmobj->x, players[displayplayer].awayviewmobj->y); + else if (!camera.chase && players[displayplayer].mo) + viewingangle = R_PointToAngle2(player->mo->x, player->mo->y, players[displayplayer].mo->x, players[displayplayer].mo->y); else - { - destx = player->mo->x; - desty = player->mo->y; - } + viewingangle = R_PointToAngle2(player->mo->x, player->mo->y, camera.x, camera.y); - sparkle = P_SpawnMobj(destx, desty, player->mo->z, MT_IVSP); - sparkle->destscale = player->mo->scale; - P_SetScale(sparkle, player->mo->scale); + destx = player->mo->x + P_ReturnThrustX(player->mo, viewingangle, FixedMul(FRACUNIT, player->mo->scale)); + desty = player->mo->y + P_ReturnThrustY(player->mo, viewingangle, FixedMul(FRACUNIT, player->mo->scale)); } - - if ((player->powers[pw_super]) && (cmd->forwardmove != 0 || cmd->sidemove != 0) - && !(leveltime % TICRATE) && (player->mo->momx || player->mo->momy)) + else { - P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_SUPERSPARK); + destx = player->mo->x; + desty = player->mo->y; } + + sparkle = P_SpawnMobj(destx, desty, player->mo->z, MT_IVSP); + sparkle->destscale = player->mo->scale; + P_SetScale(sparkle, player->mo->scale); } // Resume normal music stuff. @@ -2138,7 +2156,7 @@ static void P_DoBubbleBreath(player_t *player) else zh = player->mo->z + FixedDiv(player->mo->height,5*(FRACUNIT/4)); - if (!(player->mo->eflags & MFE_UNDERWATER) || ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL) || player->spectator) + if (!(player->mo->eflags & MFE_UNDERWATER) || ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL && !(player->pflags & PF_NIGHTSMODE)) || player->spectator) return; if (!(P_Random() % 16)) @@ -2152,6 +2170,9 @@ static void P_DoBubbleBreath(player_t *player) P_SetScale(bubble, bubble->destscale); } + if (player->pflags & PF_NIGHTSMODE) // NiGHTS Super doesn't spawn flight bubbles + return; + // Tails stirs up the water while flying in it if (player->powers[pw_tailsfly] && (leveltime & 1) && player->charability != CA_SWIM) { @@ -2379,11 +2400,12 @@ static void P_DoClimbing(player_t *player) } } - if (rover->flags & FF_CRUMBLE && !(netgame && player->spectator)) - EV_StartCrumble(rover->master->frontsector, rover, (rover->flags & FF_FLOATBOB), player, rover->alpha, !(rover->flags & FF_NORETURN)); - if (floorclimb) + { + if (rover->flags & FF_CRUMBLE && !(netgame && player->spectator)) + EV_StartCrumble(rover->master->frontsector, rover, (rover->flags & FF_FLOATBOB), player, rover->alpha, !(rover->flags & FF_NORETURN)); break; + } } } @@ -3169,6 +3191,13 @@ firenormal: // static void P_DoSuperStuff(player_t *player) { + ticcmd_t *cmd = &player->cmd; + if (player->mo->state >= &states[S_PLAY_SUPERTRANS1] && player->mo->state <= &states[S_PLAY_SUPERTRANS9]) + return; // don't do anything right now, we're in the middle of transforming! + + if (player->pflags & PF_NIGHTSMODE) + return; // NiGHTS Super doesn't mix with normal super + // Does player have all emeralds? If so, flag the "Ready For Super!" if ((ALL7EMERALDS(emeralds) || ALL7EMERALDS(player->powers[pw_emeralds])) && player->health > 50) player->pflags |= PF_SUPERREADY; @@ -3225,10 +3254,15 @@ static void P_DoSuperStuff(player_t *player) player->mo->color = SKINCOLOR_SUPER1 + (leveltime/2) % 5; break; } + + if ((cmd->forwardmove != 0 || cmd->sidemove != 0 || player->pflags & (PF_CARRIED|PF_ROPEHANG|PF_ITEMHANG|PF_MACESPIN)) + && !(leveltime % TICRATE) && (player->mo->momx || player->mo->momy)) + P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_SUPERSPARK); + G_GhostAddColor(GHC_SUPER); // Ran out of rings while super! - if (player->powers[pw_super] && (player->health <= 1 || player->exiting)) + if (player->health <= 1 || player->exiting) { player->powers[pw_emeralds] = 0; // lost the power stones P_SpawnGhostMobj(player->mo); @@ -3343,6 +3377,8 @@ void P_DoJump(player_t *player, boolean soundandstate) // Quicksand jumping. else if (P_InQuicksand(player->mo)) { + if (player->mo->ceilingz-player->mo->floorz <= player->mo->height-1) + return; player->mo->momz += (39*(FRACUNIT/4))>>1; if (player->mo->momz >= 6*FRACUNIT) player->mo->momz = 6*FRACUNIT; //max momz in quicksand @@ -3474,6 +3510,14 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd) if (player->pflags & PF_STASIS) return; +#ifdef HAVE_BLUA + if (cmd->buttons & BT_USE) + { + if (LUAh_SpinSpecial(player)) + return; + } +#endif + // Spinning and Spindashing if ((player->charability2 == CA2_SPINDASH) && !(player->pflags & PF_SLIDING) && !player->exiting && !P_PlayerInPain(player)) // subsequent revs @@ -3558,7 +3602,7 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd) // // Jump Shield Activation // -static void P_DoJumpShield(player_t *player) +void P_DoJumpShield(player_t *player) { if (player->pflags & PF_THOKKED) return; @@ -3580,7 +3624,7 @@ static void P_DoJumpShield(player_t *player) // Morph's fancy stuff-moving character ability // +ve thrust pushes away, -ve thrust pulls in // -static void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range) +void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range) { thinker_t *th; mobj_t *mo2; @@ -3640,10 +3684,13 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) { if (onground || player->climbing || player->pflags & (PF_CARRIED|PF_ITEMHANG|PF_ROPEHANG)) {} - else if ((player->pflags & PF_MACESPIN) && player->mo->tracer) + else if (player->pflags & PF_MACESPIN && player->mo->tracer) {} else if (!(player->pflags & PF_SLIDING) && ((gametype != GT_CTF) || (!player->gotflag))) { +#ifdef HAVE_BLUA + if (!LUAh_JumpSpinSpecial(player)) +#endif switch (player->charability) { case CA_TELEKINESIS: @@ -3693,8 +3740,16 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) } } - if (cmd->buttons & BT_JUMP && !(player->pflags & PF_JUMPDOWN) && !player->exiting && !P_PlayerInPain(player)) + if (cmd->buttons & BT_JUMP && !player->exiting && !P_PlayerInPain(player)) { +#ifdef HAVE_BLUA + if (LUAh_JumpSpecial(player)) + ; + else +#endif + if (player->pflags & PF_JUMPDOWN) // all situations below this require jump button not to be pressed already + ; + else // Jump S3&K style while in quicksand. if (P_InQuicksand(player->mo)) { @@ -3710,77 +3765,85 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) player->secondjump = 0; player->pflags &= ~PF_THOKKED; } - else if ((player->pflags & PF_MACESPIN) && player->mo->tracer) + else if (player->pflags & PF_MACESPIN && player->mo->tracer) { player->pflags &= ~PF_MACESPIN; player->powers[pw_flashing] = TICRATE/4; } - else if (!(player->pflags & PF_SLIDING) && ((gametype != GT_CTF) || (!player->gotflag))) + else if (player->pflags & PF_SLIDING || (gametype == GT_CTF && player->gotflag)) + ; + else if (P_SuperReady(player)) { + // If you can turn super and aren't already, + // and you don't have a shield, do it! + P_DoSuperTransformation(player, false); + } + else if (player->pflags & PF_JUMPED) + { +#ifdef HAVE_BLUA + if (!LUAh_AbilitySpecial(player)) +#endif switch (player->charability) { case CA_THOK: case CA_HOMINGTHOK: + case CA_JUMPTHOK: // Credit goes to CZ64 and Sryder13 for the original // Now it's Sonic's abilities turn! - if (player->pflags & PF_JUMPED) + // THOK! + if (!(player->pflags & PF_THOKKED) || ((player->charability2 == CA2_MULTIABILITY) /*&& (!(player->charability == CA_JUMPTHOK))*/)) { - // If you can turn super and aren't already, - // and you don't have a shield, do it! - if (P_SuperReady(player)) - P_DoSuperTransformation(player, false); - else // Otherwise, THOK! + // Catapult the player + fixed_t actionspd = player->actionspd; + if (player->mo->eflags & MFE_UNDERWATER) + actionspd >>= 1; + if (player->charability == CA_JUMPTHOK) { - if (!(player->pflags & PF_THOKKED) || (player->charability2 == CA2_MULTIABILITY)) + // Enforcing an arbitrary limit, even on just the default setting, is bad; it encourages bad WADmaking practice and disables use of that particular action speed. + // Instead, see the speed limit in 2D with the added condition below! I think that works much better, and is more consistent. -Red + //if ((actionspd == 60*FRACUNIT) && (actionspd > player->normalspeed)) //Limit only at default + //actionspd = player->normalspeed; + player->pflags &= ~PF_JUMPED; + P_DoJump(player, false); + } + P_InstaThrust(player->mo, player->mo->angle, FixedMul(actionspd, player->mo->scale)); + + if ((maptol & TOL_2D) || (player->charability == CA_JUMPTHOK)) + { + player->mo->momx /= 2; + player->mo->momy /= 2; + } + else if (player->charability == CA_HOMINGTHOK) + { + player->mo->momx /= 3; + player->mo->momy /= 3; + } + + if (player->mo->info->attacksound && !player->spectator) + S_StartSound(player->mo, player->mo->info->attacksound); // Play the THOK sound + + P_SpawnThokMobj(player); + + if (player->charability == CA_HOMINGTHOK && !player->homing) + { + if (P_LookForEnemies(player)) { - // Catapult the player - fixed_t actionspd = player->actionspd; - if (player->mo->eflags & MFE_UNDERWATER) - actionspd >>= 1; - P_InstaThrust(player->mo, player->mo->angle, FixedMul(actionspd, player->mo->scale)); - - if (maptol & TOL_2D) - { - player->mo->momx /= 2; - player->mo->momy /= 2; - } - else if (player->charability == CA_HOMINGTHOK) - { - player->mo->momx /= 3; - player->mo->momy /= 3; - } - - if (player->mo->info->attacksound && !player->spectator) - S_StartSound(player->mo, player->mo->info->attacksound); // Play the THOK sound - - P_SpawnThokMobj(player); - - if ((player->charability == CA_HOMINGTHOK) && !player->homing && (player->pflags & PF_JUMPED)) - { - if (P_LookForEnemies(player)) - { - if (player->mo->tracer) - player->homing = 3*TICRATE; - } - } - - player->pflags &= ~(PF_SPINNING|PF_STARTDASH); - player->pflags |= PF_THOKKED; + if (player->mo->tracer) + player->homing = 3*TICRATE; } } + + player->pflags &= ~(PF_SPINNING|PF_STARTDASH); + player->pflags |= PF_THOKKED; } - else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_JUMP && !player->powers[pw_super]) - P_DoJumpShield(player); break; case CA_FLY: case CA_SWIM: // Swim - // If you can turn super and aren't already, - // and you don't have a shield, do it! - if (P_SuperReady(player)) - P_DoSuperTransformation(player, false); // If currently in the air from a jump, and you pressed the // button again and have the ability to fly, do so! - else if (!(player->pflags & PF_THOKKED) && !(player->powers[pw_tailsfly]) && (player->pflags & PF_JUMPED) && !(player->charability == CA_SWIM && !(player->mo->eflags & MFE_UNDERWATER))) + if (player->charability == CA_SWIM && !(player->mo->eflags & MFE_UNDERWATER)) + ; // Can't do anything if you're a fish out of water! + else if (!(player->pflags & PF_THOKKED) && !(player->powers[pw_tailsfly])) { P_SetPlayerMobjState(player->mo, S_PLAY_ABL1); // Change to the flying animation @@ -3789,32 +3852,12 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) player->pflags &= ~(PF_JUMPED|PF_SPINNING|PF_STARTDASH); player->pflags |= PF_THOKKED; } - // If currently flying, give an ascend boost. - else if (player->powers[pw_tailsfly] && !(player->charability == CA_SWIM && !(player->mo->eflags & MFE_UNDERWATER))) - { - if (!player->fly1) - player->fly1 = 20; - else - player->fly1 = 2; - - if (player->charability == CA_SWIM) - player->fly1 /= 2; - - // Slow down! - if (player->speed > FixedMul(8*FRACUNIT, player->mo->scale) && player->speed > FixedMul(player->normalspeed>>1, player->mo->scale)) - P_Thrust(player->mo, R_PointToAngle2(0,0,player->mo->momx,player->mo->momy), FixedMul(-4*FRACUNIT, player->mo->scale)); - } - else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_JUMP && !player->powers[pw_super]) - P_DoJumpShield(player); break; - case CA_GLIDEANDCLIMB: // Now Knuckles-type abilities are checked. // If you can turn super and aren't already, // and you don't have a shield, do it! - if (P_SuperReady(player)) - P_DoSuperTransformation(player, false); - else if ((player->pflags & PF_JUMPED) && (!(player->pflags & PF_THOKKED) || player->charability2 == CA2_MULTIABILITY)) + if (!(player->pflags & PF_THOKKED) || player->charability2 == CA2_MULTIABILITY) { INT32 glidespeed = player->actionspd; @@ -3832,13 +3875,9 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) P_InstaThrust(player->mo, player->mo->angle, FixedMul(glidespeed, player->mo->scale)); player->pflags &= ~(PF_SPINNING|PF_STARTDASH); } - else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_JUMP && !player->powers[pw_super]) - P_DoJumpShield(player); break; case CA_DOUBLEJUMP: // Double-Jump - if (P_SuperReady(player)) - P_DoSuperTransformation(player, false); - else if ((player->pflags & PF_JUMPED) && !(player->pflags & PF_THOKKED)) + if (!(player->pflags & PF_THOKKED)) { player->pflags &= ~PF_JUMPED; P_DoJump(player, true); @@ -3847,81 +3886,100 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) if (!player->powers[pw_super]) player->pflags |= PF_THOKKED; } - else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_JUMP && !player->powers[pw_super]) - P_DoJumpShield(player); break; case CA_FLOAT: // Float case CA_SLOWFALL: // Slow descent hover - if (P_SuperReady(player)) - P_DoSuperTransformation(player, false); - else if ((player->pflags & PF_JUMPED) && !player->secondjump) + if (!player->secondjump) player->secondjump = 1; - else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_JUMP && !player->powers[pw_super]) - P_DoJumpShield(player); break; case CA_TELEKINESIS: - if (P_SuperReady(player)) - P_DoSuperTransformation(player, false); - else if (player->pflags & PF_JUMPED) + if (!(player->pflags & PF_THOKKED) || player->charability2 == CA2_MULTIABILITY) { - if (!(player->pflags & PF_THOKKED) || (player->charability2 == CA2_MULTIABILITY)) - { - P_Telekinesis(player, - FixedMul(player->actionspd, player->mo->scale), // +ve thrust (pushing away from player) - FixedMul(384*FRACUNIT, player->mo->scale)); - } + P_Telekinesis(player, + FixedMul(player->actionspd, player->mo->scale), // +ve thrust (pushing away from player) + FixedMul(384*FRACUNIT, player->mo->scale)); } - else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_JUMP && !player->powers[pw_super]) - P_DoJumpShield(player); break; case CA_FALLSWITCH: - if (P_SuperReady(player)) - P_DoSuperTransformation(player, false); - else if (player->pflags & PF_JUMPED) + if (!(player->pflags & PF_THOKKED) || player->charability2 == CA2_MULTIABILITY) { - if (!(player->pflags & PF_THOKKED) || (player->charability2 == CA2_MULTIABILITY)) - { - player->mo->momz = -player->mo->momz; - P_SpawnThokMobj(player); - player->pflags |= PF_THOKKED; - } + player->mo->momz = -player->mo->momz; + P_SpawnThokMobj(player); + player->pflags |= PF_THOKKED; } - else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_JUMP && !player->powers[pw_super]) - P_DoJumpShield(player); break; case CA_AIRDRILL: - if (P_SuperReady(player)) - P_DoSuperTransformation(player, false); - else if(player->pflags & PF_JUMPED) + if (!(player->pflags & PF_THOKKED) || player->charability2 == CA2_MULTIABILITY) { - if (!(player->pflags & PF_THOKKED) || (player->charability2 == CA2_MULTIABILITY)) - { - player->flyangle = 56 + (60-(player->actionspd>>FRACBITS))/3; - player->pflags |= PF_THOKKED; - S_StartSound(player->mo, sfx_spndsh); - } + player->flyangle = 56 + (60-(player->actionspd>>FRACBITS))/3; + player->pflags |= PF_THOKKED; + S_StartSound(player->mo, sfx_spndsh); } - else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_JUMP && !player->powers[pw_super]) - P_DoJumpShield(player); - break; - case CA_JUMPBOOST: - case CA_NONE: - // Characters who don't normally have a second jump of any sort - // There's still stuff for them to do of course! - if (P_SuperReady(player)) - P_DoSuperTransformation(player, false); - else if (!(player->pflags & PF_JUMPED) && (player->powers[pw_shield] & SH_NOSTACK) == SH_JUMP && !player->powers[pw_super]) - P_DoJumpShield(player); break; default: break; } } - } - player->pflags |= PF_JUMPDOWN; + else if (player->pflags & PF_THOKKED) + { +#ifdef HAVE_BLUA + if (!LUAh_AbilitySpecial(player)) +#endif + switch (player->charability) + { + case CA_FLY: + case CA_SWIM: // Swim + if (player->charability == CA_SWIM && !(player->mo->eflags & MFE_UNDERWATER)) + ; // Can't do anything if you're a fish out of water! + else if (player->powers[pw_tailsfly]) // If currently flying, give an ascend boost. + { + if (!player->fly1) + player->fly1 = 20; + else + player->fly1 = 2; - if (!(cmd->buttons & BT_JUMP))// If not pressing the jump button + if (player->charability == CA_SWIM) + player->fly1 /= 2; + + // Slow down! + if (player->speed > FixedMul(8*FRACUNIT, player->mo->scale) && player->speed > FixedMul(player->normalspeed>>1, player->mo->scale)) + P_Thrust(player->mo, R_PointToAngle2(0,0,player->mo->momx,player->mo->momy), FixedMul(-4*FRACUNIT, player->mo->scale)); + } + break; + default: + break; + } + } + else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_JUMP && !player->powers[pw_super]) + P_DoJumpShield(player); + } + + if (cmd->buttons & BT_JUMP) + { + player->pflags |= PF_JUMPDOWN; + + if ((gametype != GT_CTF || !player->gotflag) && !player->exiting) + { + if (player->secondjump == 1) + { + if (player->charability == CA_FLOAT) + player->mo->momz = 0; + else if (player->charability == CA_SLOWFALL) + { + if (player->powers[pw_super]) + { + if (P_MobjFlip(player->mo)*player->mo->momz < gravity*16) + player->mo->momz = P_MobjFlip(player->mo)*gravity*16; //Float upward 4x as fast while super. + } + else if (P_MobjFlip(player->mo)*player->mo->momz < -gravity*4) + player->mo->momz = P_MobjFlip(player->mo)*-gravity*4; + } + player->pflags &= ~PF_SPINNING; + } + } + } + else // If not pressing the jump button { player->pflags &= ~PF_JUMPDOWN; @@ -3929,44 +3987,25 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) if ((player->charability2 == CA2_MULTIABILITY && player->charability != CA_DOUBLEJUMP) || (player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]))) player->secondjump = 0; - else if ((player->charability == CA_FLOAT) && player->secondjump == 1) + else if (player->charability == CA_FLOAT && player->secondjump == 1) player->secondjump = 2; - } - if ((gametype != GT_CTF) || (!player->gotflag)) - { - if (player->secondjump == 1 && (cmd->buttons & BT_JUMP)) + + // If letting go of the jump button while still on ascent, cut the jump height. + if (player->pflags & PF_JUMPED && P_MobjFlip(player->mo)*player->mo->momz > 0 && player->jumping == 1) { - if (player->charability == CA_FLOAT) - player->mo->momz = 0; - else if (player->charability == CA_SLOWFALL) - { - if (!(player->mo->eflags & MFE_VERTICALFLIP)) - { - if (!player->powers[pw_super] && player->mo->momz < -gravity*4) - player->mo->momz = -gravity*4; - else if (player->powers[pw_super] && player->mo->momz < gravity*16) - player->mo->momz = gravity*16; //Float upward 4x as fast while super. - } - else - { - if (!player->powers[pw_super] && player->mo->momz > gravity*4) - player->mo->momz = gravity*4; - else if (player->powers[pw_super] && player->mo->momz > -gravity*16) - player->mo->momz = -gravity*16; //Float "upward" 4x as fast while super. - } - } - - player->pflags &= ~PF_SPINNING; + player->mo->momz >>= 1; + player->jumping = 0; } } +} - // If letting go of the jump button while still on ascent, cut the jump height. - if (!(player->pflags & PF_JUMPDOWN) && (player->pflags & PF_JUMPED) && P_MobjFlip(player->mo)*player->mo->momz > 0 && player->jumping == 1) - { - player->mo->momz >>= 1; - player->jumping = 0; - } +static boolean P_AnalogMove(player_t *player) +{ + if (netgame) + return false; + return ((player == &players[consoleplayer] && cv_analog.value) + || (player == &players[secondarydisplayplayer] && cv_analog2.value)); } // @@ -3983,94 +4022,54 @@ INT32 P_GetPlayerControlDirection(player_t *player) ticcmd_t *cmd = &player->cmd; angle_t controllerdirection, controlplayerdirection; camera_t *thiscam; + angle_t dangle; + fixed_t tempx = 0, tempy = 0; + angle_t tempangle, origtempangle; if (splitscreen && player == &players[secondarydisplayplayer]) thiscam = &camera2; else thiscam = &camera; - if (!netgame && ((player == &players[consoleplayer] && cv_analog.value) - || (player == &players[secondarydisplayplayer] - && cv_analog2.value)) && thiscam->chase) + if (!cmd->forwardmove && !cmd->sidemove) + return 0; + + if (P_AnalogMove(player) && thiscam->chase) { - fixed_t tempx, tempy; - angle_t tempangle; - - tempx = tempy = 0; - - // Calculate the angle at which the controls are pointing - // to figure out the proper mforward and mbackward. - tempangle = thiscam->angle; - tempangle >>= ANGLETOFINESHIFT; - tempx += FixedMul(cmd->forwardmove,FINECOSINE(tempangle)); - tempy += FixedMul(cmd->forwardmove,FINESINE(tempangle)); - - tempangle = thiscam->angle-ANGLE_90; - tempangle >>= ANGLETOFINESHIFT; - tempx += FixedMul(cmd->sidemove,FINECOSINE(tempangle)); - tempy += FixedMul(cmd->sidemove,FINESINE(tempangle)); - - tempx = tempx*FRACUNIT; - tempy = tempy*FRACUNIT; - - controllerdirection = - R_PointToAngle2(player->mo->x, player->mo->y, player->mo->x + tempx, - player->mo->y + tempy); - + if (player->awayviewtics) + origtempangle = tempangle = player->awayviewmobj->angle; + else + origtempangle = tempangle = thiscam->angle; controlplayerdirection = player->mo->angle; - - if (controlplayerdirection < ANGLE_90) - { - controlplayerdirection += ANGLE_90; - controllerdirection += ANGLE_90; - } - else if (controlplayerdirection >= ANGLE_270) - { - controlplayerdirection -= ANGLE_90; - controllerdirection -= ANGLE_90; - } - - // Controls pointing backwards from player - if (controllerdirection > controlplayerdirection + ANGLE_90 - && controllerdirection < controlplayerdirection - ANGLE_90) - { - return 2; - } - else // Controls pointing in player's general direction - return 1; } else { - if (!cmd->forwardmove) - return 0; + origtempangle = tempangle = player->mo->angle; + controlplayerdirection = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); } - controllerdirection = - R_PointToAngle2(player->mo->x, player->mo->y, P_ReturnThrustX(player->mo, player->mo->angle, cmd->forwardmove), - P_ReturnThrustY(player->mo, player->mo->angle, cmd->forwardmove)); + // Calculate the angle at which the controls are pointing + // to figure out the proper mforward and mbackward. + tempangle >>= ANGLETOFINESHIFT; + tempx += FixedMul(cmd->forwardmove*FRACUNIT,FINECOSINE(tempangle)); + tempy += FixedMul(cmd->forwardmove*FRACUNIT,FINESINE(tempangle)); - controlplayerdirection = R_PointToAngle2(0, 0, player->mo->momx, - player->mo->momy); + tempangle = origtempangle-ANGLE_90; + tempangle >>= ANGLETOFINESHIFT; + tempx += FixedMul(cmd->sidemove*FRACUNIT,FINECOSINE(tempangle)); + tempy += FixedMul(cmd->sidemove*FRACUNIT,FINESINE(tempangle)); - if (controlplayerdirection < ANGLE_90) - { - controlplayerdirection += ANGLE_90; - controllerdirection += ANGLE_90; - } - else if (controlplayerdirection >= ANGLE_270) - { - controlplayerdirection -= ANGLE_90; - controllerdirection -= ANGLE_90; - } + controllerdirection = R_PointToAngle2(0, 0, tempx, tempy); - // Controls pointing backwards from player - if (controllerdirection > controlplayerdirection + ANGLE_90 - && controllerdirection < controlplayerdirection - ANGLE_90) - { - return 2; - } - else // Controls pointing in player's general direction - return 1; + dangle = controllerdirection - controlplayerdirection; + + if (dangle > ANGLE_180) //flip to keep to one side + dangle = InvAngle(dangle); + + if (dangle > ANGLE_90) + return 2; // Controls pointing backwards from player + else + return 1; // Controls pointing in player's general direction } // Control scheme for 2d levels. @@ -4219,8 +4218,7 @@ static void P_2dMovement(player_t *player) player->mo->momx = 0; } - - if (cmd->sidemove != 0 && !(player->climbing || player->pflags & PF_GLIDING || player->exiting + else if (cmd->sidemove != 0 && !(player->pflags & PF_GLIDING || player->exiting || (P_PlayerInPain(player) && !onground))) { movepushforward = abs(cmd->sidemove) * (thrustfactor * acceleration); @@ -4270,10 +4268,7 @@ static void P_3dMovement(player_t *player) else thiscam = &camera; - analogmove = (!netgame - && ((player == &players[consoleplayer] && cv_analog.value) - || (player == &players[secondarydisplayplayer] && cv_analog2.value)) - && thiscam->chase); + analogmove = (P_AnalogMove(player) && thiscam->chase); cmd = &player->cmd; @@ -4300,14 +4295,16 @@ static void P_3dMovement(player_t *player) if (analogmove) { - movepushangle = thiscam->angle; - movepushsideangle = thiscam->angle-ANGLE_90; + if (player->awayviewtics) + movepushangle = player->awayviewmobj->angle; + else + movepushangle = thiscam->angle; } else { movepushangle = player->mo->angle; - movepushsideangle = player->mo->angle-ANGLE_90; } + movepushsideangle = movepushangle-ANGLE_90; // cmomx/cmomy stands for the conveyor belt speed. if (player->onconveyor == 2) // Wind/Current @@ -4473,58 +4470,43 @@ static void P_3dMovement(player_t *player) { if (!(player->pflags & PF_GLIDING || player->exiting || P_PlayerInPain(player))) { - angle_t controldirection, controllerdirection, controlplayerdirection; - fixed_t tempx, tempy; + angle_t controldirection; + fixed_t tempx = 0, tempy = 0; angle_t tempangle; #ifdef OLD_MOVEMENT_CODE + angle_t controlplayerdirection; boolean cforward; // controls pointing forward from the player boolean cbackward; // controls pointing backward from the player -#endif + angle_t dangle; - tempx = tempy = 0; -#ifdef OLD_MOVEMENT_CODE cforward = cbackward = false; #endif - // Calculate the angle at which the controls are pointing // to figure out the proper mforward and mbackward. - tempangle = thiscam->angle; + tempangle = movepushangle; tempangle >>= ANGLETOFINESHIFT; - tempx += FixedMul(cmd->forwardmove,FINECOSINE(tempangle)); - tempy += FixedMul(cmd->forwardmove,FINESINE(tempangle)); + tempx += FixedMul(cmd->forwardmove*FRACUNIT,FINECOSINE(tempangle)); + tempy += FixedMul(cmd->forwardmove*FRACUNIT,FINESINE(tempangle)); - tempangle = thiscam->angle-ANGLE_90; + tempangle = movepushsideangle; tempangle >>= ANGLETOFINESHIFT; - tempx += FixedMul(cmd->sidemove,FINECOSINE(tempangle)); - tempy += FixedMul(cmd->sidemove,FINESINE(tempangle)); + tempx += FixedMul(cmd->sidemove*FRACUNIT,FINECOSINE(tempangle)); + tempy += FixedMul(cmd->sidemove*FRACUNIT,FINESINE(tempangle)); - tempx = tempx*FRACUNIT; - tempy = tempy*FRACUNIT; - - controldirection = controllerdirection = - R_PointToAngle2(player->mo->x, player->mo->y, player->mo->x + tempx, - player->mo->y + tempy); - - controlplayerdirection = player->mo->angle; - - if (controlplayerdirection < ANGLE_90) - { - controlplayerdirection += ANGLE_90; - controllerdirection += ANGLE_90; - } - else if (controlplayerdirection >= ANGLE_270) - { - controlplayerdirection -= ANGLE_90; - controllerdirection -= ANGLE_90; - } + controldirection = R_PointToAngle2(0, 0, tempx, tempy); #ifdef OLD_MOVEMENT_CODE - // Controls pointing backwards from player - if (controllerdirection > controlplayerdirection + ANGLE_90 - && controllerdirection < controlplayerdirection - ANGLE_90) - cbackward = true; - else // Controls pointing in player's general direction - cforward = true; + controlplayerdirection = player->mo->angle; + + dangle = controldirection - controlplayerdirection; + + if (dangle > ANGLE_180) //flip to keep to one side + dangle = InvAngle(dangle); + + if (dangle > ANGLE_90) + cbackward = true; // Controls pointing backwards from player + else + cforward = true; // Controls pointing in player's general direction #endif movepushforward = max(abs(cmd->sidemove), abs(cmd->forwardmove)) * (thrustfactor * acceleration); @@ -4561,66 +4543,63 @@ static void P_3dMovement(player_t *player) #endif } } - else + else if (cmd->sidemove && !(player->pflags & PF_GLIDING) && !player->exiting && !P_PlayerInPain(player)) { - if (cmd->sidemove && !(player->pflags & PF_GLIDING) && !player->exiting && !P_PlayerInPain(player)) +#ifdef OLD_MOVEMENT_CODE + boolean mright = 0; + boolean mleft = 0; + angle_t sideangle; + + sideangle = player->mo->angle - ANGLE_90; + + // Monster Iestyn - 04-11-13 + // Quadrants are stupid, excessive and broken, let's do this a much simpler way! + // Get delta angle from rmom angle and player angle first + dangle = R_PointToAngle2(0,0, player->rmomx, player->rmomy) - sideangle; + if (dangle > ANGLE_180) + dangle = InvAngle(dangle); + + // now use it to determine direction! + if (dangle <= ANGLE_45) // angles 0-45 or 315-360 + mright = 1; // going right + else if (dangle >= ANGLE_135) // angles 135-225 + mleft = 1; // going left + + // anything else will leave both at 0, so no need to do anything else +#endif + + movepushside = cmd->sidemove * (thrustfactor * acceleration); + + if (!onground) { -#ifdef OLD_MOVEMENT_CODE - boolean mright = 0; - boolean mleft = 0; - angle_t sideangle; + movepushside >>= 2; - sideangle = player->mo->angle - ANGLE_90; - - // Monster Iestyn - 04-11-13 - // Quadrants are stupid, excessive and broken, let's do this a much simpler way! - // Get delta angle from rmom angle and player angle first - dangle = R_PointToAngle2(0,0, player->rmomx, player->rmomy) - sideangle; - if (dangle > ANGLE_180) - dangle = InvAngle(dangle); - - // now use it to determine direction! - if (dangle <= ANGLE_45) // angles 0-45 or 315-360 - mright = 1; // going right - else if (dangle >= ANGLE_135) // angles 135-225 - mleft = 1; // going left - - // anything else will leave both at 0, so no need to do anything else -#endif - - movepushside = cmd->sidemove * (thrustfactor * acceleration); - - if (!onground) - { + // Reduce movepushslide even more if over "max" flight speed + if (player->powers[pw_tailsfly] && player->speed > topspeed) movepushside >>= 2; - - // Reduce movepushslide even more if over "max" flight speed - if (player->powers[pw_tailsfly] && player->speed > topspeed) - movepushside >>= 2; - } - - // Allow a bit of movement while spinning - if (player->pflags & PF_SPINNING) - { - if (!(player->pflags & PF_STARTDASH)) - movepushside = FixedDiv(movepushside,16*FRACUNIT); - else - movepushside = 0; - } - - // Finally move the player now that his speed/direction has been decided. - movepushside = FixedMul(movepushside, player->mo->scale); -#ifdef OLD_MOVEMENT_CODE - if (player->speed < topspeed) - P_Thrust(player->mo, movepushsideangle, movepushside); - else if (mright && cmd->sidemove < 0) - P_Thrust(player->mo, movepushsideangle, movepushside); - else if (mleft && cmd->sidemove > 0) - P_Thrust(player->mo, movepushsideangle, movepushside); -#else - P_Thrust(player->mo, movepushsideangle, movepushside); -#endif } + + // Allow a bit of movement while spinning + if (player->pflags & PF_SPINNING) + { + if (!(player->pflags & PF_STARTDASH)) + movepushside = FixedDiv(movepushside,16*FRACUNIT); + else + movepushside = 0; + } + + // Finally move the player now that his speed/direction has been decided. + movepushside = FixedMul(movepushside, player->mo->scale); +#ifdef OLD_MOVEMENT_CODE + if (player->speed < topspeed) + P_Thrust(player->mo, movepushsideangle, movepushside); + else if (mright && cmd->sidemove < 0) + P_Thrust(player->mo, movepushsideangle, movepushside); + else if (mleft && cmd->sidemove > 0) + P_Thrust(player->mo, movepushsideangle, movepushside); +#else + P_Thrust(player->mo, movepushsideangle, movepushside); +#endif } #ifndef OLD_MOVEMENT_CODE @@ -4768,6 +4747,7 @@ static void P_ShootLine(mobj_t *source, mobj_t *dest, fixed_t height) static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t radius) { + mobj_t* targ; if (player->pflags & PF_TRANSFERTOCLOSEST) { const angle_t fa = R_PointToAngle2(player->axis1->x, player->axis1->y, player->axis2->x, player->axis2->y); @@ -4780,6 +4760,20 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad player->mo->momy = player->mo->target->y + FixedMul(FINESINE(fa),radius) - player->mo->y; } + if (player->exiting) + return; + + // You're welcome, Rob. -Red + targ = player->mo->target; + if (!P_TryMove(player->mo, player->mo->x+player->mo->momx, player->mo->y+player->mo->momy, true)) + return; + else + P_TeleportMove(player->mo, player->mo->x-player->mo->momx, player->mo->y-player->mo->momy, player->mo->z); + + if (!(player->pflags & PF_TRANSFERTOCLOSEST) && !player->mo->target) { + P_SetTarget(&player->mo->target, targ); + P_SetMobjState(player->mo->tracer, S_SUPERTRANS1); + } { const INT32 sequence = player->mo->target->threshold; mobj_t *transfer1 = NULL; @@ -4792,6 +4786,7 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad boolean transfer1last = false; boolean transfer2last = false; vertex_t vertices[4]; + fixed_t truexspeed = xspeed*(!(player->pflags & PF_TRANSFERTOCLOSEST) && player->mo->target->flags & MF_AMBUSH ? -1 : 1); // Find next waypoint for (th = thinkercap.next; th != &thinkercap; th = th->next) @@ -4898,6 +4893,7 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad CONS_Debug(DBG_NIGHTS, "Transfer1 : %d\n", transfer1->health); CONS_Debug(DBG_NIGHTS, "Transfer2 : %d\n", transfer2->health); } + //CONS_Debug(DBG_NIGHTS, "Xspeed : %d", truexspeed); //CONS_Debug(DBG_NIGHTS, "T1 is at %d, %d\n", transfer1->x>>FRACBITS, transfer1->y>>FRACBITS); //CONS_Debug(DBG_NIGHTS, "T2 is at %d, %d\n", transfer2->x>>FRACBITS, transfer2->y>>FRACBITS); @@ -4908,6 +4904,8 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad if (P_AproxDistance(transfer1->x - player->mo->x, transfer1->y - player->mo->y)>>FRACBITS < P_AproxDistance(transfer2->x - player->mo->x, transfer2->y - player->mo->y)>>FRACBITS) { + //CONS_Debug(DBG_NIGHTS, " must be < 0 to transfer\n"); + if (transfer1->type == MT_AXISTRANSFERLINE) { if (transfer1last) @@ -4940,7 +4938,8 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad transfer1line.dy = transfer1line.v2->y - transfer1line.v1->y; if (P_PointOnLineSide(player->mo->x, player->mo->y, &transfer1line) - != P_PointOnLineSide(player->mo->x+player->mo->momx, player->mo->y+player->mo->momy, &transfer1line)) + != P_PointOnLineSide(player->mo->x+player->mo->momx, player->mo->y+player->mo->momy, &transfer1line) + && truexspeed < 0) { if (cv_debug & DBG_NIGHTS) { @@ -4995,7 +4994,8 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad transfer1line.dy = transfer1line.v2->y - transfer1line.v1->y; if (P_PointOnLineSide(player->mo->x, player->mo->y, &transfer1line) - != P_PointOnLineSide(player->mo->x+player->mo->momx, player->mo->y+player->mo->momy, &transfer1line)) + != P_PointOnLineSide(player->mo->x+player->mo->momx, player->mo->y+player->mo->momy, &transfer1line) + && truexspeed < 0) { if (cv_debug & DBG_NIGHTS) { @@ -5024,6 +5024,7 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad } else { + //CONS_Debug(DBG_NIGHTS, " must be > 0 to transfer\n"); if (transfer2->type == MT_AXISTRANSFERLINE) { if (transfer2last) @@ -5059,7 +5060,8 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad transfer2line.dy = transfer2line.v2->y - transfer2line.v1->y; if (P_PointOnLineSide(player->mo->x, player->mo->y, &transfer2line) - != P_PointOnLineSide(player->mo->x+player->mo->momx, player->mo->y+player->mo->momy, &transfer2line)) + != P_PointOnLineSide(player->mo->x+player->mo->momx, player->mo->y+player->mo->momy, &transfer2line) + && truexspeed > 0) { if (cv_debug & DBG_NIGHTS) { @@ -5124,7 +5126,8 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad transfer2line.dy = transfer2line.v2->y - transfer2line.v1->y; if (P_PointOnLineSide(player->mo->x, player->mo->y, &transfer2line) - != P_PointOnLineSide(player->mo->x+player->mo->momx, player->mo->y+player->mo->momy, &transfer2line)) + != P_PointOnLineSide(player->mo->x+player->mo->momx, player->mo->y+player->mo->momy, &transfer2line) + && truexspeed > 0) { if (cv_debug & DBG_NIGHTS) { @@ -5268,7 +5271,7 @@ static void P_DoNiGHTSCapsule(player_t *player) P_SetMobjState(emmo, mobjinfo[MT_GOTEMERALD].meleestate + em); }*/ - if (player->mo->tracer) // \todo: find some way to make NiGHTS special stages completable for non-NiGHTS players, if the special stage allows it + if (player->mo->tracer) { // Only give it to ONE person, and THAT player has to get to the goal! emmo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->info->height, MT_GOTEMERALD); @@ -5461,47 +5464,6 @@ static void P_NiGHTSMovement(player_t *player) player->mo->flags2 |= MF2_DONTDRAW; P_SetScale(player->mo->tracer, player->mo->scale); - // Check for flipped 'gravity' - { - boolean no3dfloorgrav = true; // Custom gravity - - player->mo->eflags &= ~MFE_VERTICALFLIP; - - if (player->mo->subsector->sector->ffloors) // Check for 3D floor gravity too. - { - ffloor_t *rover; - - for (rover = player->mo->subsector->sector->ffloors; rover; rover = rover->next) - { - if (!(rover->flags & FF_EXISTS)) - continue; - - if (P_InsideANonSolidFFloor(player->mo, rover)) - { - if (rover->master->frontsector->gravity) - { - if (rover->master->frontsector->verticalflip) - player->mo->eflags |= MFE_VERTICALFLIP; - - no3dfloorgrav = false; - break; - } - } - } - } - - if (no3dfloorgrav) - { - if (player->mo->subsector->sector->verticalflip) - player->mo->eflags |= MFE_VERTICALFLIP; - } - } - - if (player->mo->eflags & MFE_VERTICALFLIP) - player->mo->tracer->eflags |= MFE_VERTICALFLIP; - else - player->mo->tracer->eflags &= ~MFE_VERTICALFLIP; - if (player->mo->eflags & MFE_VERTICALFLIP) cmd->forwardmove = (SINT8)(-cmd->forwardmove); @@ -5576,10 +5538,15 @@ static void P_NiGHTSMovement(player_t *player) mobj_t *firstmobj; mobj_t *secondmobj; fixed_t spawndist = FixedMul(16*FRACUNIT, player->mo->scale); + fixed_t z = player->mo->z + player->mo->height/2; - firstmobj = P_SpawnMobj(player->mo->x + P_ReturnThrustX(player->mo, player->mo->angle+ANGLE_90, spawndist), player->mo->y + P_ReturnThrustY(player->mo, player->mo->angle+ANGLE_90, spawndist), player->mo->z + player->mo->height/2, MT_NIGHTSPARKLE); - secondmobj = P_SpawnMobj(player->mo->x + P_ReturnThrustX(player->mo, player->mo->angle-ANGLE_90, spawndist), player->mo->y + P_ReturnThrustY(player->mo, player->mo->angle-ANGLE_90, spawndist), player->mo->z + player->mo->height/2, MT_NIGHTSPARKLE); + if (player->mo->eflags & MFE_VERTICALFLIP) + z -= FixedMul(mobjinfo[MT_NIGHTSPARKLE].height, player->mo->scale); + firstmobj = P_SpawnMobj(player->mo->x + P_ReturnThrustX(player->mo, player->mo->angle+ANGLE_90, spawndist), player->mo->y + P_ReturnThrustY(player->mo, player->mo->angle+ANGLE_90, spawndist), z, MT_NIGHTSPARKLE); + secondmobj = P_SpawnMobj(player->mo->x + P_ReturnThrustX(player->mo, player->mo->angle-ANGLE_90, spawndist), player->mo->y + P_ReturnThrustY(player->mo, player->mo->angle-ANGLE_90, spawndist), z, MT_NIGHTSPARKLE); + + firstmobj->destscale = secondmobj->destscale = player->mo->scale; P_SetTarget(&firstmobj->target, player->mo); P_SetScale(firstmobj, player->mo->scale); P_SetTarget(&secondmobj->target, player->mo); @@ -5768,6 +5735,14 @@ static void P_NiGHTSMovement(player_t *player) P_NightsTransferPoints(player, xspeed, radius); + // Check here after transferring because the game can be dumb sometimes -Red + if (player->mo->tracer->state >= &states[S_SUPERTRANS1] + && player->mo->tracer->state <= &states[S_SUPERTRANS9]) + { + player->mo->momx = player->mo->momy = player->mo->momz = 0; + return; + } + if (still) player->mo->momz = -FRACUNIT; else @@ -5779,36 +5754,27 @@ static void P_NiGHTSMovement(player_t *player) player->mo->momz = -20*FRACUNIT; // You can create splashes as you fly across water. - if (player->mo->z + P_GetPlayerHeight(player) >= player->mo->watertop && player->mo->z <= player->mo->watertop && player->speed > 9000 - && leveltime % (TICRATE/7) == 0 && !player->spectator) + if (((!(player->mo->eflags & MFE_VERTICALFLIP) + && player->mo->z + P_GetPlayerHeight(player) >= player->mo->watertop && player->mo->z <= player->mo->watertop) + || (player->mo->eflags & MFE_VERTICALFLIP + && player->mo->z + player->mo->height - P_GetPlayerHeight(player) <= player->mo->waterbottom && player->mo->z + player->mo->height >= player->mo->waterbottom)) + && player->speed > 9000 && leveltime % (TICRATE/7) == 0 && !player->spectator) { - mobj_t *water = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->watertop, MT_SPLISH); + mobj_t *water = P_SpawnMobj(player->mo->x, player->mo->y, + ((player->mo->eflags & MFE_VERTICALFLIP) ? player->mo->waterbottom - FixedMul(mobjinfo[MT_SPLISH].height, player->mo->scale) : player->mo->watertop), MT_SPLISH); if (player->mo->eflags & MFE_GOOWATER) S_StartSound(water, sfx_ghit); else S_StartSound(water, sfx_wslap); + if (player->mo->eflags & MFE_VERTICALFLIP) + { + water->flags2 |= MF2_OBJECTFLIP; + water->eflags |= MFE_VERTICALFLIP; + } water->destscale = player->mo->scale; P_SetScale(water, player->mo->scale); } - // Spawn Sonic's bubbles - if (player->mo->eflags & MFE_UNDERWATER && !player->spectator) - { - const fixed_t zh = player->mo->z + FixedDiv(player->mo->height, 5*(FRACUNIT/4)); - mobj_t *bubble = NULL; - if (!(P_Random() % 16)) - bubble = P_SpawnMobj(player->mo->x, player->mo->y, zh, MT_SMALLBUBBLE); - else if (!(P_Random() % 96)) - bubble = P_SpawnMobj(player->mo->x, player->mo->y, zh, MT_MEDIUMBUBBLE); - - if (bubble) - { - bubble->threshold = 42; - bubble->destscale = player->mo->scale; - P_SetScale(bubble,player->mo->scale); - } - } - if (player->mo->momx || player->mo->momy) player->mo->angle = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); @@ -5830,7 +5796,7 @@ static void P_NiGHTSMovement(player_t *player) else if (player->angle_pos > player->old_angle_pos) neg = -1; - movingangle = R_PointToAngle2(0, player->mo->z, neg*R_PointToDist2(player->mo->momx, player->mo->momy, 0, 0), player->mo->z + player->mo->momz); + movingangle = R_PointToAngle2(0, 0, neg*R_PointToDist2(player->mo->momx, player->mo->momy, 0, 0), player->mo->momz); player->anotherflyangle = (movingangle >> ANGLETOFINESHIFT) * 360/FINEANGLES; } @@ -5943,8 +5909,6 @@ static void P_NiGHTSMovement(player_t *player) } } - P_CheckSneakerAndLivesTimer(player); - if (objectplacing) OP_NightsObjectplace(player); } @@ -6020,61 +5984,44 @@ void P_ElementalFireTrail(player_t *player) fixed_t ground; mobj_t *flame; angle_t travelangle; + INT32 i; I_Assert(player != NULL); I_Assert(player->mo != NULL); I_Assert(!P_MobjWasRemoved(player->mo)); if (player->mo->eflags & MFE_VERTICALFLIP) - ground = player->mo->ceilingz - mobjinfo[MT_SPINFIRE].height - 1; + ground = player->mo->ceilingz - FixedMul(mobjinfo[MT_SPINFIRE].height, player->mo->scale); else - ground = player->mo->floorz + 1; + ground = player->mo->floorz; - travelangle = R_PointToAngle2(player->mo->x, player->mo->y, player->rmomx + player->mo->x, player->rmomy + player->mo->y); + travelangle = R_PointToAngle2(0, 0, player->rmomx, player->rmomy); - newx = player->mo->x + P_ReturnThrustX(player->mo, travelangle + ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale)); - newy = player->mo->y + P_ReturnThrustY(player->mo, travelangle + ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale)); - flame = P_SpawnMobj(newx, newy, ground, MT_SPINFIRE); - P_SetTarget(&flame->target, player->mo); - flame->angle = travelangle; - flame->fuse = TICRATE*6; - flame->destscale = player->mo->scale; - P_SetScale(flame, player->mo->scale); - if (player->mo->eflags & MFE_VERTICALFLIP) - flame->eflags |= MFE_VERTICALFLIP; - - flame->momx = 8; - P_XYMovement(flame); - - if (player->mo->eflags & MFE_VERTICALFLIP) + for (i = 0; i < 2; i++) { - if (flame->z + flame->height < flame->ceilingz-1) + newx = player->mo->x + P_ReturnThrustX(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale)); + newy = player->mo->y + P_ReturnThrustY(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale)); + flame = P_SpawnMobj(newx, newy, ground, MT_SPINFIRE); + P_SetTarget(&flame->target, player->mo); + flame->angle = travelangle; + flame->fuse = TICRATE*6; + flame->destscale = player->mo->scale; + P_SetScale(flame, player->mo->scale); + flame->eflags = (flame->eflags & ~MFE_VERTICALFLIP)|(player->mo->eflags & MFE_VERTICALFLIP); + + flame->momx = 8; + P_XYMovement(flame); + if (P_MobjWasRemoved(flame)) + continue; + + if (player->mo->eflags & MFE_VERTICALFLIP) + { + if (flame->z + flame->height < flame->ceilingz) + P_RemoveMobj(flame); + } + else if (flame->z > flame->floorz) P_RemoveMobj(flame); } - else if (flame->z > flame->floorz+1) - P_RemoveMobj(flame); - - newx = player->mo->x + P_ReturnThrustX(player->mo, travelangle - ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale)); - newy = player->mo->y + P_ReturnThrustY(player->mo, travelangle - ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale)); - flame = P_SpawnMobj(newx, newy, ground, MT_SPINFIRE); - P_SetTarget(&flame->target, player->mo); - flame->angle = travelangle; - flame->fuse = TICRATE*6; - flame->destscale = player->mo->scale; - P_SetScale(flame, player->mo->scale); - if (player->mo->eflags & MFE_VERTICALFLIP) - flame->eflags |= MFE_VERTICALFLIP; - - flame->momx = 8; - P_XYMovement(flame); - - if (player->mo->eflags & MFE_VERTICALFLIP) - { - if (flame->z + flame->height < flame->ceilingz-1) - P_RemoveMobj(flame); - } - else if (flame->z > flame->floorz+1) - P_RemoveMobj(flame); } static void P_SkidStuff(player_t *player) @@ -6138,7 +6085,8 @@ static void P_SkidStuff(player_t *player) } } else if (P_AproxDistance(pmx, pmy) >= FixedMul(player->runspeed/2, player->mo->scale) // if you were moving faster than half your run speed last frame - && (player->mo->momx != pmx || player->mo->momy != pmy)) // and you are moving differently this frame + && (player->mo->momx != pmx || player->mo->momy != pmy) // and you are moving differently this frame + && P_GetPlayerControlDirection(player) == 2) // and your controls are pointing in the opposite direction to your movement { // check for skidding angle_t mang = R_PointToAngle2(0,0,pmx,pmy); // movement angle angle_t pang = R_PointToAngle2(pmx,pmy,player->mo->momx,player->mo->momy); // push angle @@ -6168,16 +6116,11 @@ static void P_SkidStuff(player_t *player) // // P_MovePlayer -// -// todo: This seriously needs to be split up. -// 913 lines of code in this function. static void P_MovePlayer(player_t *player) { ticcmd_t *cmd; INT32 i; - fixed_t tempx, tempy; - angle_t tempangle; camera_t *thiscam; fixed_t runspd; @@ -6191,8 +6134,6 @@ static void P_MovePlayer(player_t *player) if (player->mo->state >= &states[S_PLAY_SUPERTRANS1] && player->mo->state <= &states[S_PLAY_SUPERTRANS9]) { - P_CheckSneakerAndLivesTimer(player); - P_CheckUnderwaterAndSpaceTimer(player); player->mo->momx = player->mo->momy = player->mo->momz = 0; return; } @@ -6200,109 +6141,6 @@ static void P_MovePlayer(player_t *player) cmd = &player->cmd; runspd = FixedMul(player->runspeed, player->mo->scale); - if ((netgame || splitscreen) && player->spectator && (cmd->buttons & BT_ATTACK) && !player->powers[pw_flashing]) - { - if (!cv_allowteamchange.value) - { - if (P_IsLocalPlayer(player)) - CONS_Printf(M_GetText("Server does not allow team change.\n")); - player->powers[pw_flashing] += 2*TICRATE; //to prevent message spam. - } - - // Team changing in Team Match and CTF - // Pressing fire assigns you to a team that needs players if allowed. - // Partial code reproduction from p_tick.c autobalance code. - else if (G_GametypeHasTeams()) - { - INT32 changeto = 0; - INT32 z, numplayersred = 0, numplayersblue = 0; - - //find a team by num players, score, or random if all else fails. - for (z = 0; z < MAXPLAYERS; ++z) - if (playeringame[z]) - { - if (players[z].ctfteam == 1) - ++numplayersred; - else if (players[z].ctfteam == 2) - ++numplayersblue; - } - // for z - - if (numplayersblue > numplayersred) - changeto = 1; - else if (numplayersred > numplayersblue) - changeto = 2; - else if (bluescore > redscore) - changeto = 1; - else if (redscore > bluescore) - changeto = 2; - else - changeto = (P_Random() & 1) + 1; - - if (player->mo) - { - P_RemoveMobj(player->mo); - player->mo = NULL; - } - player->spectator = false; - player->ctfteam = changeto; - player->playerstate = PST_REBORN; - - //Reset away view - if (P_IsLocalPlayer(player) && displayplayer != consoleplayer) - displayplayer = consoleplayer; - - if (changeto == 1) - CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[player-players], '\x85', M_GetText("Red Team"), '\x80'); - else if (changeto == 2) - CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[player-players], '\x84', M_GetText("Blue Team"), '\x80'); - - return; // no more player->mo, cannot continue. - } - - // Joining in game from firing. - else - { - // Exception for hide and seek. Don't join a game when you simply - // respawn in place and sit there for the rest of the round. - if (!(gametype == GT_HIDEANDSEEK && leveltime > (hidetime * TICRATE))) - { - if (player->mo) - { - P_RemoveMobj(player->mo); - player->mo = NULL; - } - player->spectator = false; - player->playerstate = PST_REBORN; - - if (gametype == GT_TAG) - { - //Make joining players "it" after hidetime. - if (leveltime > (hidetime * TICRATE)) - { - CONS_Printf(M_GetText("%s is now IT!\n"), player_names[player-players]); // Tell everyone who is it! - player->pflags |= PF_TAGIT; - } - - P_CheckSurvivors(); - } - - //Reset away view - if (P_IsLocalPlayer(player) && displayplayer != consoleplayer) - displayplayer = consoleplayer; - - CONS_Printf(M_GetText("%s entered the game.\n"), player_names[player-players]); - return; // no more player->mo, cannot continue. - } - else - { - if (P_IsLocalPlayer(player)) - CONS_Printf(M_GetText("You must wait until next round to enter the game.\n")); - player->powers[pw_flashing] += 2*TICRATE; //to prevent message spam. - } - } - } - // Control relinquishing stuff! if (player->powers[pw_ingoop]) player->pflags |= PF_FULLSTASIS; @@ -6349,48 +6187,14 @@ static void P_MovePlayer(player_t *player) } } - // Even if not NiGHTS, pull in nearby objects when walking around as John Q. Elliot. - if (!objectplacing && !((netgame || multiplayer) && player->spectator) - && ((maptol & TOL_NIGHTS)) && (!(player->pflags & PF_NIGHTSMODE) || player->powers[pw_nights_helper])) + if (player->spectator) { - thinker_t *th; - mobj_t *mo2; - fixed_t x = player->mo->x; - fixed_t y = player->mo->y; - fixed_t z = player->mo->z; - - for (th = thinkercap.next; th != &thinkercap; th = th->next) - { - if (th->function.acp1 != (actionf_p1)P_MobjThinker) - continue; - - mo2 = (mobj_t *)th; - - if (!(mo2->type == MT_NIGHTSWING || mo2->type == MT_RING || mo2->type == MT_COIN -#ifdef BLUE_SPHERES - || mo2->type == MT_BLUEBALL -#endif - )) - continue; - - if (P_AproxDistance(P_AproxDistance(mo2->x - x, mo2->y - y), mo2->z - z) > FixedMul(128*FRACUNIT, player->mo->scale)) - continue; - - // Yay! The thing's in reach! Pull it in! - mo2->flags |= MF_NOCLIP|MF_NOCLIPHEIGHT; - mo2->flags2 |= MF2_NIGHTSPULL; - P_SetTarget(&mo2->tracer, player->mo); - } - } - - if (player->linktimer && !player->powers[pw_nights_linkfreeze]) - { - if (--player->linktimer <= 0) // Link timer - player->linkcount = 0; + P_SpectatorMovement(player); + return; } // Locate the capsule for this mare. - if (maptol & TOL_NIGHTS) + else if (maptol & TOL_NIGHTS) { if (!player->capsule && !player->bonustime) { @@ -6429,7 +6233,7 @@ static void P_MovePlayer(player_t *player) return; } - if ((player->pflags & PF_NIGHTSFALL) && P_IsObjectOnGround(player->mo)) + if (player->pflags & PF_NIGHTSFALL && P_IsObjectOnGround(player->mo)) { if (G_IsSpecialStage(gamemap)) { @@ -6445,26 +6249,16 @@ static void P_MovePlayer(player_t *player) } } - else if (player->spectator) - { - P_SpectatorMovement(player); - return; - } - ////////////////////// // MOVEMENT CODE // ////////////////////// - if (twodlevel || (player->mo->flags2 & MF2_TWOD)) // 2d-level, so special control applies. + if (twodlevel || player->mo->flags2 & MF2_TWOD) // 2d-level, so special control applies. P_2dMovement(player); else { - if (!player->climbing && (netgame || (player == &players[consoleplayer] - && !cv_analog.value) || (player == &players[secondarydisplayplayer] && !cv_analog2.value) - || (player->pflags & PF_SPINNING))) - { + if (!player->climbing && (!P_AnalogMove(player) || player->pflags & PF_SPINNING)) player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */); - } ticruned++; if ((cmd->angleturn & TICCMD_RECEIVED) == 0) @@ -6533,6 +6327,23 @@ static void P_MovePlayer(player_t *player) else if (player->dashspeed > 0 && player->dashspeed < FixedMul(player->mindash, player->mo->scale)) player->dashspeed = FixedMul(player->mindash, player->mo->scale); + if (!(player->charability == CA_GLIDEANDCLIMB) || player->gotflag) // If you can't glide, then why the heck would you be gliding? + { + if (player->pflags & PF_GLIDING || player->climbing) + { + if (onground) + P_SetPlayerMobjState(player->mo, S_PLAY_RUN1); + else + { + player->pflags |= PF_JUMPED; + P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); + } + } + player->pflags &= ~PF_GLIDING; + player->glidetime = 0; + player->climbing = 0; + } + // Glide MOMZ // AKA my own gravity. =) if (player->pflags & PF_GLIDING) @@ -6577,7 +6388,9 @@ static void P_MovePlayer(player_t *player) if (!(player->pflags & PF_JUMPDOWN)) // If not holding the jump button { P_ResetPlayer(player); // down, stop gliding. - if ((player->charability2 == CA2_MULTIABILITY) + if (onground) + P_SetPlayerMobjState(player->mo, S_PLAY_RUN1); + else if ((player->charability2 == CA2_MULTIABILITY) || (player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]) && player->charability == CA_GLIDEANDCLIMB)) { player->pflags |= PF_JUMPED; @@ -6608,13 +6421,6 @@ static void P_MovePlayer(player_t *player) } } - if (!(player->charability == CA_GLIDEANDCLIMB)) // If you can't glide, then why the heck would you be gliding? - { - player->pflags &= ~PF_GLIDING; - player->glidetime = 0; - player->climbing = 0; - } - // If you're running fast enough, you can create splashes as you run in shallow water. if (!player->climbing && ((!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + player->mo->height >= player->mo->watertop && player->mo->z <= player->mo->watertop) @@ -6644,63 +6450,34 @@ static void P_MovePlayer(player_t *player) S_StartSound(player->mo, sfx_floush); } -#if 1 - // "Blur" a bit when you have speed shoes and are going fast enough - if ((player->powers[pw_super] || player->powers[pw_sneakers]) && (player->speed + abs(player->mo->momz)) > FixedMul(20*FRACUNIT,player->mo->scale)) - { - mobj_t *gmobj = P_SpawnGhostMobj(player->mo); - gmobj->fuse = 2; - if (leveltime & 1) - { - gmobj->frame &= ~FF_TRANSMASK; - gmobj->frame |= tr_trans70<flags2 |= MF2_DONTDRAW; - } -#endif - - ////////////////////////////////////////////////////// - // P_GivePlayerRings now handles Extra Life Bonuses // - ////////////////////////////////////////////////////// - - ////////////////////////// - // SUPER SONIC STUFF // - ////////////////////////// - - P_DoSuperStuff(player); - - ///////////////////////// - //Special Music Changes// - ///////////////////////// - - P_CheckSneakerAndLivesTimer(player); - - /////////////////////////////////////////////////////// - //LOTS OF UNDERWATER CODE (Well, used to be, anyway) // - /////////////////////////////////////////////////////// - - // Spawn Sonic's bubbles - P_DoBubbleBreath(player); - - // Display the countdown drown numbers! - P_CheckUnderwaterAndSpaceTimer(player); - //////////////// //TAILS FLYING// //////////////// + if (!(player->charability == CA_FLY || player->charability == CA_SWIM)) // why are you flying when you cannot fly?! + { + if (player->powers[pw_tailsfly] + || (player->mo->state >= &states[S_PLAY_SPC1] && player->mo->state <= &states[S_PLAY_SPC4])) + { + if (onground) + P_SetPlayerMobjState(player->mo, S_PLAY_RUN1); + else + { + player->pflags |= PF_JUMPED; + P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); + } + } + player->powers[pw_tailsfly] = 0; + } + + if (player->gotflag && player->powers[pw_tailsfly]) + player->powers[pw_tailsfly] = 1; + // If not in a fly position, don't think you're flying! if (player->panim != PA_ABILITY) player->powers[pw_tailsfly] = 0; - if (!(player->pflags & PF_STASIS) && (player->charability == CA_FLY || (player->charability == CA_SWIM && (player->mo->eflags & MFE_UNDERWATER)))) + if (player->charability == CA_FLY || (player->charability == CA_SWIM && player->mo->eflags & MFE_UNDERWATER)) { // Fly counter for Tails. if (player->powers[pw_tailsfly]) @@ -6710,7 +6487,7 @@ static void P_MovePlayer(player_t *player) if (player->charability2 == CA2_MULTIABILITY) { // Adventure-style flying by just holding the button down - if (cmd->buttons & BT_JUMP) + if (cmd->buttons & BT_JUMP && !(player->pflags & PF_STASIS) && !player->exiting) P_SetObjectMomZ(player->mo, actionspd/4, true); } else @@ -6730,7 +6507,7 @@ static void P_MovePlayer(player_t *player) S_StartSound(player->mo, sfx_putput); // Descend - if (cmd->buttons & BT_USE) + if (cmd->buttons & BT_USE && !(player->pflags & PF_STASIS) && !player->exiting) if (P_MobjFlip(player->mo)*player->mo->momz > -FixedMul(5*actionspd, player->mo->scale)) P_SetObjectMomZ(player->mo, -actionspd/2, true); @@ -6749,9 +6526,6 @@ static void P_MovePlayer(player_t *player) } } - // Spawn Invincibility Sparkles - P_CheckInvincibilityTimer(player); - // End your chain if you're on the ground or climbing a wall. // But not if invincible! Allow for some crazy long chains with it. // Also keep in mind the PF_JUMPED check. @@ -6794,43 +6568,41 @@ static void P_MovePlayer(player_t *player) if (!(player->pflags & PF_SPINNING)) player->pflags &= ~PF_STARTDASH; - // spawn stuff over your head! - P_DoPlayerHeadSigns(player); - ////////////////// //ANALOG CONTROL// ////////////////// - if (!netgame && ((player == &players[consoleplayer] && cv_analog.value) || (player == &players[secondarydisplayplayer] && cv_analog2.value)) - && (cmd->forwardmove != 0 || cmd->sidemove != 0) && !player->climbing && !twodlevel && !(player->mo && (player->mo->flags2 & MF2_TWOD))) + // This really looks like it should be moved to P_3dMovement. -Red + if (P_AnalogMove(player) && thiscam->chase + && (cmd->forwardmove != 0 || cmd->sidemove != 0) && !player->climbing && !twodlevel && !(player->mo->flags2 & MF2_TWOD)) { // If travelling slow enough, face the way the controls // point and not your direction of movement. - if (player->speed < FixedMul(5*FRACUNIT, player->mo->scale) || player->pflags & PF_GLIDING - || (!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z > player->mo->floorz) - || (player->mo->eflags & MFE_VERTICALFLIP && player->mo->z+player->mo->height < player->mo->ceilingz)) + if (player->speed < FixedMul(5*FRACUNIT, player->mo->scale) || player->pflags & PF_GLIDING || !onground) { - tempx = tempy = 0; + fixed_t tempx = 0, tempy = 0; + angle_t tempangle; - tempangle = thiscam->angle; + if (player->awayviewtics) + tempangle = player->awayviewmobj->angle; + else + tempangle = thiscam->angle; tempangle >>= ANGLETOFINESHIFT; - tempx += FixedMul(cmd->forwardmove,FINECOSINE(tempangle)); - tempy += FixedMul(cmd->forwardmove,FINESINE(tempangle)); + tempx += FixedMul(cmd->forwardmove*FRACUNIT,FINECOSINE(tempangle)); + tempy += FixedMul(cmd->forwardmove*FRACUNIT,FINESINE(tempangle)); - tempangle = thiscam->angle-ANGLE_90; + tempangle <<= ANGLETOFINESHIFT; + tempangle -= ANGLE_90; tempangle >>= ANGLETOFINESHIFT; - tempx += FixedMul(cmd->sidemove,FINECOSINE(tempangle)); - tempy += FixedMul(cmd->sidemove,FINESINE(tempangle)); + tempx += FixedMul(cmd->sidemove*FRACUNIT,FINECOSINE(tempangle)); + tempy += FixedMul(cmd->sidemove*FRACUNIT,FINESINE(tempangle)); - tempx = tempx*FRACUNIT; - tempy = tempy*FRACUNIT; - - player->mo->angle = R_PointToAngle2(player->mo->x, player->mo->y, player->mo->x + tempx, player->mo->y + tempy); + player->mo->angle = R_PointToAngle2(0, 0, tempx, tempy); } // Otherwise, face the direction you're travelling. else if (player->panim == PA_WALK || player->panim == PA_RUN || player->panim == PA_ROLL || ((player->mo->state >= &states[S_PLAY_ABL1] && player->mo->state <= &states[S_PLAY_SPC4]) && player->charability == CA_FLY)) - player->mo->angle = R_PointToAngle2(player->mo->x, player->mo->y, player->rmomx + player->mo->x, player->rmomy + player->mo->y); + player->mo->angle = R_PointToAngle2(0, 0, player->rmomx, player->rmomy); // Update the local angle control. if (player == &players[consoleplayer]) @@ -7006,7 +6778,7 @@ static void P_MovePlayer(player_t *player) fixed_t speed; const fixed_t runnyspeed = 20*FRACUNIT; - speed = R_PointToDist2(player->mo->x + player->rmomx, player->mo->y + player->rmomy, player->mo->x, player->mo->y); + speed = R_PointToDist2(player->rmomx, player->rmomy, 0, 0); if (speed > player->normalspeed-5*FRACUNIT) speed = player->normalspeed-5*FRACUNIT; @@ -7014,13 +6786,13 @@ static void P_MovePlayer(player_t *player) if (speed >= runnyspeed) player->fovadd = speed-runnyspeed; else - player->fovadd = 0*FRACUNIT; + player->fovadd = 0; - if (player->fovadd < 0*FRACUNIT) - player->fovadd = 0*FRACUNIT; + if (player->fovadd < 0) + player->fovadd = 0; } else - player->fovadd = 0*FRACUNIT; + player->fovadd = 0; #endif #ifdef FLOORSPLATS @@ -7469,6 +7241,9 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius) if (!G_RingSlingerGametype() && mo->type == MT_PLAYER) continue; // Don't hurt players in Co-Op! + if (abs(inflictor->x - mo->x) > radius || abs(inflictor->y - mo->y) > radius || abs(inflictor->z - mo->z) > radius) + continue; // Workaround for possible integer overflow in the below -Red + if (P_AproxDistance(P_AproxDistance(inflictor->x - mo->x, inflictor->y - mo->y), inflictor->z - mo->z) > radius) continue; @@ -7567,6 +7342,7 @@ boolean P_LookForEnemies(player_t *player) void P_HomingAttack(mobj_t *source, mobj_t *enemy) // Home in on your target { fixed_t dist; + fixed_t ns = 0; if (!enemy) return; @@ -7592,35 +7368,20 @@ void P_HomingAttack(mobj_t *source, mobj_t *enemy) // Home in on your target dist = 1; if (source->type == MT_DETON && enemy->player) // For Deton Chase (Unused) - { - fixed_t ns = FixedDiv(FixedMul(enemy->player->normalspeed, enemy->scale), FixedDiv(20*FRACUNIT,17*FRACUNIT)); - source->momx = FixedMul(FixedDiv(enemy->x - source->x, dist), ns); - source->momy = FixedMul(FixedDiv(enemy->y - source->y, dist), ns); - source->momz = FixedMul(FixedDiv(enemy->z - source->z, dist), ns); - } + ns = FixedDiv(FixedMul(enemy->player->normalspeed, enemy->scale), FixedDiv(20*FRACUNIT,17*FRACUNIT)); else if (source->type != MT_PLAYER) { if (source->threshold == 32000) - { - fixed_t ns = FixedMul(source->info->speed/2, source->scale); - source->momx = FixedMul(FixedDiv(enemy->x - source->x, dist), ns); - source->momy = FixedMul(FixedDiv(enemy->y - source->y, dist), ns); - source->momz = FixedMul(FixedDiv(enemy->z - source->z, dist), ns); - } + ns = FixedMul(source->info->speed/2, source->scale); else - { - source->momx = FixedMul(FixedDiv(enemy->x - source->x, dist), FixedMul(source->info->speed, source->scale)); - source->momy = FixedMul(FixedDiv(enemy->y - source->y, dist), FixedMul(source->info->speed, source->scale)); - source->momz = FixedMul(FixedDiv(enemy->z - source->z, dist), FixedMul(source->info->speed, source->scale)); - } + ns = FixedMul(source->info->speed, source->scale); } else if (source->player) - { - const fixed_t ns = FixedMul(source->player->actionspd, source->player->mo->scale); - source->momx = FixedMul(FixedDiv(enemy->x - source->x, dist), FixedDiv(ns,3*FRACUNIT/2)); - source->momy = FixedMul(FixedDiv(enemy->y - source->y, dist), FixedDiv(ns,3*FRACUNIT/2)); - source->momz = FixedMul(FixedDiv(enemy->z - source->z, dist), FixedDiv(ns,3*FRACUNIT/2)); - } + ns = FixedDiv(FixedMul(source->player->actionspd, source->scale), 3*FRACUNIT/2); + + source->momx = FixedMul(FixedDiv(enemy->x - source->x, dist), ns); + source->momy = FixedMul(FixedDiv(enemy->y - source->y, dist), ns); + source->momz = FixedMul(FixedDiv(enemy->z - source->z, dist), ns); } // Search for emeralds @@ -7944,25 +7705,12 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (P_CameraThinker(player, thiscam, resetcalled)) return true; - if (player->pflags & PF_NIGHTSMODE) - { - if (splitscreen && player == &players[secondarydisplayplayer]) - CV_SetValue(&cv_cam2_dist, 320); - else if (player == &players[displayplayer]) - CV_SetValue(&cv_cam_dist, 320); - } - if (thiscam == &camera) { camspeed = cv_cam_speed.value; camstill = cv_cam_still.value; camrotate = cv_cam_rotate.value; - - if (player->pflags & PF_NIGHTSMODE) - camdist = cv_cam_dist.value; - else - camdist = FixedMul(cv_cam_dist.value, mo->scale); - + camdist = FixedMul(cv_cam_dist.value, mo->scale); camheight = FixedMul(cv_cam_height.value, mo->scale); } else // Camera 2 @@ -7970,12 +7718,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall camspeed = cv_cam2_speed.value; camstill = cv_cam2_still.value; camrotate = cv_cam2_rotate.value; - - if (player->pflags & PF_NIGHTSMODE) - camdist = cv_cam2_dist.value; - else - camdist = FixedMul(cv_cam2_dist.value, mo->scale); - + camdist = FixedMul(cv_cam2_dist.value, mo->scale); camheight = FixedMul(cv_cam2_height.value, mo->scale); } @@ -8013,11 +7756,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall localangle -= abs(focusangle - localangle)>>5; } } - else if ((player == &players[consoleplayer] && cv_analog.value) - || (player == &players[secondarydisplayplayer] && cv_analog2.value)) // Analog - { + else if (P_AnalogMove(player)) // Analog angle = R_PointToAngle2(thiscam->x, thiscam->y, mo->x, mo->y); - } else angle = focusangle + FixedAngle(camrotate*FRACUNIT); @@ -8071,11 +7811,13 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall // sets ideal cam pos if (twodlevel || (mo->flags2 & MF2_TWOD)) dist = 480<pflags & PF_NIGHTSMODE) + dist = 320<climbing || (player->exiting && !(player->pflags & PF_NIGHTSMODE)) || player->playerstate == PST_DEAD || (player->pflags & (PF_MACESPIN|PF_ITEMHANG|PF_ROPEHANG))) + if (player->climbing || player->exiting || player->playerstate == PST_DEAD || (player->pflags & (PF_MACESPIN|PF_ITEMHANG|PF_ROPEHANG))) dist <<= 1; } @@ -8139,7 +7881,12 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall // Cameras use the heightsec's heights rather then the actual sector heights. // If you can see through it, why not move the camera through it too? - if (newsubsec->sector->heightsec >= 0) + if (newsubsec->sector->camsec >= 0) + { + myfloorz = sectors[newsubsec->sector->camsec].floorheight; + myceilingz = sectors[newsubsec->sector->camsec].ceilingheight; + } + else if (newsubsec->sector->heightsec >= 0) { myfloorz = sectors[newsubsec->sector->heightsec].floorheight; myceilingz = sectors[newsubsec->sector->heightsec].ceilingheight; @@ -8426,11 +8173,133 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall return (x == thiscam->x && y == thiscam->y && z == thiscam->z && angle == thiscam->aiming); } +static boolean P_SpectatorJoinGame(player_t *player) +{ + if (!G_GametypeHasSpectators() && G_IsSpecialStage(gamemap) && useNightsSS) // Special Stage spectators should NEVER be allowed to rejoin the game + { + if (P_IsLocalPlayer(player)) + CONS_Printf(M_GetText("You cannot enter the game while a special stage is in progress.\n")); + player->powers[pw_flashing] += 2*TICRATE; //to prevent message spam. + } + + else if (!cv_allowteamchange.value) + { + if (P_IsLocalPlayer(player)) + CONS_Printf(M_GetText("Server does not allow team change.\n")); + player->powers[pw_flashing] += 2*TICRATE; //to prevent message spam. + } + + // Team changing in Team Match and CTF + // Pressing fire assigns you to a team that needs players if allowed. + // Partial code reproduction from p_tick.c autobalance code. + else if (G_GametypeHasTeams()) + { + INT32 changeto = 0; + INT32 z, numplayersred = 0, numplayersblue = 0; + + //find a team by num players, score, or random if all else fails. + for (z = 0; z < MAXPLAYERS; ++z) + if (playeringame[z]) + { + if (players[z].ctfteam == 1) + ++numplayersred; + else if (players[z].ctfteam == 2) + ++numplayersblue; + } + // for z + + if (numplayersblue > numplayersred) + changeto = 1; + else if (numplayersred > numplayersblue) + changeto = 2; + else if (bluescore > redscore) + changeto = 1; + else if (redscore > bluescore) + changeto = 2; + else + changeto = (P_Random() & 1) + 1; + + if (player->mo) + { + P_RemoveMobj(player->mo); + player->mo = NULL; + } + player->spectator = false; + player->ctfteam = changeto; + player->playerstate = PST_REBORN; + + //Reset away view + if (P_IsLocalPlayer(player) && displayplayer != consoleplayer) + displayplayer = consoleplayer; + + if (changeto == 1) + CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[player-players], '\x85', M_GetText("Red Team"), '\x80'); + else if (changeto == 2) + CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[player-players], '\x84', M_GetText("Blue Team"), '\x80'); + + return true; // no more player->mo, cannot continue. + } + // Joining in game from firing. + else + { + // Exception for hide and seek. Don't join a game when you simply + // respawn in place and sit there for the rest of the round. + if (!(gametype == GT_HIDEANDSEEK && leveltime > (hidetime * TICRATE))) + { + if (player->mo) + { + P_RemoveMobj(player->mo); + player->mo = NULL; + } + player->spectator = false; + player->playerstate = PST_REBORN; + + if (gametype == GT_TAG) + { + //Make joining players "it" after hidetime. + if (leveltime > (hidetime * TICRATE)) + { + CONS_Printf(M_GetText("%s is now IT!\n"), player_names[player-players]); // Tell everyone who is it! + player->pflags |= PF_TAGIT; + } + + P_CheckSurvivors(); + } + + //Reset away view + if (P_IsLocalPlayer(player) && displayplayer != consoleplayer) + displayplayer = consoleplayer; + + CONS_Printf(M_GetText("%s entered the game.\n"), player_names[player-players]); + return true; // no more player->mo, cannot continue. + } + else + { + if (P_IsLocalPlayer(player)) + CONS_Printf(M_GetText("You must wait until next round to enter the game.\n")); + player->powers[pw_flashing] += 2*TICRATE; //to prevent message spam. + } + } + return false; +} + static void P_CalcPostImg(player_t *player) { sector_t *sector = player->mo->subsector->sector; postimg_t *type; INT32 *param; + fixed_t pviewheight; + + if (player->mo->eflags & MFE_VERTICALFLIP) + pviewheight = player->mo->z + player->mo->height - player->viewheight; + else + pviewheight = player->mo->z + player->viewheight; + + if (player->awayviewtics) + { + sector = player->awayviewmobj->subsector->sector; + pviewheight = player->awayviewmobj->z + 20*FRACUNIT; + } if (splitscreen && player == &players[secondarydisplayplayer]) { @@ -8456,30 +8325,11 @@ static void P_CalcPostImg(player_t *player) if (!(rover->flags & FF_EXISTS)) continue; - if (player->mo->eflags & MFE_VERTICALFLIP) - { - if (*rover->topheight < player->mo->z + player->mo->height - player->viewheight - || *rover->bottomheight >= player->mo->z + player->mo->height - player->viewheight) - continue; + if (pviewheight >= *rover->topheight || pviewheight <= *rover->bottomheight) + continue; - if (player->mo->z + player->mo->height - player->viewheight < *rover->topheight) - { - if (P_FindSpecialLineFromTag(13, rover->master->frontsector->tag, -1) != -1) - *type = postimg_heat; - } - } - else - { - if (*rover->topheight <= player->mo->z + player->viewheight - || *rover->bottomheight > player->mo->z + player->viewheight) - continue; - - if (player->mo->z + player->viewheight < *rover->topheight) - { - if (P_FindSpecialLineFromTag(13, rover->master->frontsector->tag, -1) != -1) - *type = postimg_heat; - } - } + if (P_FindSpecialLineFromTag(13, rover->master->frontsector->tag, -1) != -1) + *type = postimg_heat; } } @@ -8493,24 +8343,10 @@ static void P_CalcPostImg(player_t *player) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKPLAYER) continue; - if (player->mo->eflags & MFE_VERTICALFLIP) - { - if (*rover->topheight < player->mo->z + player->mo->height - player->viewheight - || *rover->bottomheight >= player->mo->z + player->mo->height - player->viewheight) - continue; + if (pviewheight >= *rover->topheight || pviewheight <= *rover->bottomheight) + continue; - if (player->mo->z + player->mo->height - player->viewheight > *rover->bottomheight) - *type = postimg_water; - } - else - { - if (*rover->topheight <= player->mo->z + player->viewheight - || *rover->bottomheight > player->mo->z + player->viewheight) - continue; - - if (player->mo->z + player->viewheight < *rover->topheight) - *type = postimg_water; - } + *type = postimg_water; } } @@ -8788,6 +8624,52 @@ void P_PlayerThink(player_t *player) player->realtime = leveltime; } + if ((netgame || splitscreen) && player->spectator && cmd->buttons & BT_ATTACK && !player->powers[pw_flashing]) + { + if (P_SpectatorJoinGame(player)) + return; // player->mo was removed. + } + + // Even if not NiGHTS, pull in nearby objects when walking around as John Q. Elliot. + if (!objectplacing && !((netgame || multiplayer) && player->spectator) + && maptol & TOL_NIGHTS && (!(player->pflags & PF_NIGHTSMODE) || player->powers[pw_nights_helper])) + { + thinker_t *th; + mobj_t *mo2; + fixed_t x = player->mo->x; + fixed_t y = player->mo->y; + fixed_t z = player->mo->z; + + for (th = thinkercap.next; th != &thinkercap; th = th->next) + { + if (th->function.acp1 != (actionf_p1)P_MobjThinker) + continue; + + mo2 = (mobj_t *)th; + + if (!(mo2->type == MT_NIGHTSWING || mo2->type == MT_RING || mo2->type == MT_COIN +#ifdef BLUE_SPHERES + || mo2->type == MT_BLUEBALL +#endif + )) + continue; + + if (P_AproxDistance(P_AproxDistance(mo2->x - x, mo2->y - y), mo2->z - z) > FixedMul(128*FRACUNIT, player->mo->scale)) + continue; + + // Yay! The thing's in reach! Pull it in! + mo2->flags |= MF_NOCLIP|MF_NOCLIPHEIGHT; + mo2->flags2 |= MF2_NIGHTSPULL; + P_SetTarget(&mo2->tracer, player->mo); + } + } + + if (player->linktimer && !player->powers[pw_nights_linkfreeze]) + { + if (--player->linktimer <= 0) // Link timer + player->linkcount = 0; + } + // Move around. // Reactiontime is used to prevent movement // for a bit after a teleport. @@ -8797,11 +8679,8 @@ void P_PlayerThink(player_t *player) { if (player->pflags & PF_ROPEHANG) { - if ((netgame || (player == &players[consoleplayer] - && !cv_analog.value) || (player == &players[secondarydisplayplayer] && !cv_analog2.value))) - { + if (!P_AnalogMove(player)) player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */); - } ticruned++; if ((cmd->angleturn & TICCMD_RECEIVED) == 0) @@ -8818,14 +8697,7 @@ void P_PlayerThink(player_t *player) P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); } player->rmomx = player->rmomy = 0; // no actual momentum from your controls - - P_DoSuperStuff(player); - P_CheckSneakerAndLivesTimer(player); - P_DoBubbleBreath(player); - P_CheckUnderwaterAndSpaceTimer(player); - P_CheckInvincibilityTimer(player); P_ResetScore(player); - P_DoPlayerHeadSigns(player); } else P_MovePlayer(player); @@ -8833,6 +8705,35 @@ void P_PlayerThink(player_t *player) if (!player->mo) return; // P_MovePlayer removed player->mo. + P_DoSuperStuff(player); + P_CheckSneakerAndLivesTimer(player); + P_DoBubbleBreath(player); // Spawn Sonic's bubbles + P_CheckUnderwaterAndSpaceTimer(player); // Display the countdown drown numbers! + P_CheckInvincibilityTimer(player); // Spawn Invincibility Sparkles + P_DoPlayerHeadSigns(player); // Spawn Tag/CTF signs over player's head + +#if 1 + // "Blur" a bit when you have speed shoes and are going fast enough + if ((player->powers[pw_super] || player->powers[pw_sneakers]) && (player->speed + abs(player->mo->momz)) > FixedMul(20*FRACUNIT,player->mo->scale)) + { + mobj_t *gmobj = P_SpawnGhostMobj(player->mo); + gmobj->fuse = 2; + if (leveltime & 1) + { + gmobj->frame &= ~FF_TRANSMASK; + gmobj->frame |= tr_trans70<flags2 |= MF2_DONTDRAW; + } +#endif + // check for use if (!(player->pflags & PF_NIGHTSMODE)) { @@ -8849,7 +8750,10 @@ void P_PlayerThink(player_t *player) P_UnsetThingPosition(player->mo->tracer); player->mo->tracer->x = player->mo->x; player->mo->tracer->y = player->mo->y; - player->mo->tracer->z = player->mo->z; + if (player->mo->eflags & MFE_VERTICALFLIP) + player->mo->tracer->z = player->mo->z + player->mo->height - player->mo->tracer->height; + else + player->mo->tracer->z = player->mo->z; player->mo->tracer->floorz = player->mo->floorz; player->mo->tracer->ceilingz = player->mo->ceilingz; P_SetThingPosition(player->mo->tracer); @@ -8871,7 +8775,7 @@ void P_PlayerThink(player_t *player) if (player->powers[pw_tailsfly] && player->powers[pw_tailsfly] < UINT16_MAX && player->charability != CA_SWIM && !(player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]))) // tails fly counter player->powers[pw_tailsfly]--; - if (player->powers[pw_underwater] && ((player->pflags & PF_GODMODE) || (player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL)) + if (player->powers[pw_underwater] && (player->pflags & PF_GODMODE || (player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL)) { if (player->powers[pw_underwater] <= 12*TICRATE+1) P_RestoreMusic(player); //incase they were about to drown @@ -8881,7 +8785,7 @@ void P_PlayerThink(player_t *player) else if (player->powers[pw_underwater] && !(maptol & TOL_NIGHTS) && !((netgame || multiplayer) && player->spectator)) // underwater timer player->powers[pw_underwater]--; - if (player->powers[pw_spacetime] && ((player->pflags & PF_GODMODE) || (player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL)) + if (player->powers[pw_spacetime] && (player->pflags & PF_GODMODE || (player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL)) player->powers[pw_spacetime] = 0; else if (player->powers[pw_spacetime] && !(maptol & TOL_NIGHTS) && !((netgame || multiplayer) && player->spectator)) // underwater timer player->powers[pw_spacetime]--; @@ -8957,7 +8861,7 @@ void P_PlayerThink(player_t *player) else player->mo->flags2 &= ~MF2_DONTDRAW; } - else + else if (player->mo->tracer) { if (player->powers[pw_flashing] & 1) player->mo->tracer->flags2 |= MF2_DONTDRAW; @@ -9045,7 +8949,7 @@ void P_PlayerAfterThink(player_t *player) if (player->pflags & PF_NIGHTSMODE) { player->powers[pw_gravityboots] = 0; - player->mo->eflags &= ~MFE_VERTICALFLIP; + //player->mo->eflags &= ~MFE_VERTICALFLIP; } if (!(player->pflags & PF_WPNDOWN)) diff --git a/src/r_data.c b/src/r_data.c index c8226b3f1..930b70bf5 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -999,7 +999,7 @@ void R_ReInitColormaps(UINT16 num) char colormap[9] = "COLORMAP"; lumpnum_t lump; - if (num <= 9999) + if (num > 0 && num <= 10000) snprintf(colormap, 8, "CLM%04u", num-1); // Load in the light tables, now 64k aligned for smokie... diff --git a/src/r_defs.h b/src/r_defs.h index f818ed65c..5a5eaf97a 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -155,8 +155,6 @@ typedef struct ffloor_s fixed_t *bottomyoffs; angle_t *bottomangle; - fixed_t delta; - size_t secnum; ffloortype_e flags; struct line_s *master; @@ -269,6 +267,7 @@ typedef struct sector_s angle_t ceilingpic_angle; INT32 heightsec; // other sector, or -1 if no other sector + INT32 camsec; // used for camera clipping INT32 floorlightsec, ceilinglightsec; INT32 crumblestate; // used for crumbling and bobbing diff --git a/src/r_main.c b/src/r_main.c index e17f749e4..231dfe29b 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1304,6 +1304,7 @@ void R_RegisterEngineStuff(void) CV_RegisterVar(&cv_grdynamiclighting); CV_RegisterVar(&cv_grcoronas); CV_RegisterVar(&cv_grcoronasize); + CV_RegisterVar(&cv_grmd2); #endif #ifdef HWRENDER diff --git a/src/s_sound.c b/src/s_sound.c index 6e6c492a3..b48b60a05 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -253,7 +253,7 @@ void S_RegisterSoundStuff(void) CV_RegisterVar(&surround); CV_RegisterVar(&cv_samplerate); -#if defined (macintosh) && !defined (SDL) // mp3 playlist stuff +#if defined (macintosh) && !defined (HAVE_SDL) // mp3 playlist stuff { INT32 i; for (i = 0; i < PLAYLIST_LENGTH; i++) @@ -761,7 +761,7 @@ void S_PauseSound(void) } // pause cd music -#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL) +#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) I_PauseCD(); #else I_StopCD(); @@ -1050,7 +1050,7 @@ static boolean S_MIDIMusic(musicinfo_t *music, boolean looping) // load & register it music->data = W_CacheLumpNum(music->lumpnum, PU_MUSIC); -#if defined (macintosh) && !defined (SDL) +#if defined (macintosh) && !defined (HAVE_SDL) music->handle = I_RegisterSong(music_num); #else music->handle = I_RegisterSong(music->data, W_LumpLength(music->lumpnum)); @@ -1154,7 +1154,7 @@ void S_StopMusic(void) I_StopSong(mus_playing->handle); I_UnRegisterSong(mus_playing->handle); -#ifndef SDL //SDL uses RWOPS +#ifndef HAVE_SDL //SDL uses RWOPS Z_ChangeTag(mus_playing->data, PU_CACHE); #endif diff --git a/src/s_sound.h b/src/s_sound.h index 200b5bb3f..6589ca598 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -37,7 +37,7 @@ extern CV_PossibleValue_t soundvolume_cons_t[]; //part of i_cdmus.c extern consvar_t cd_volume, cdUpdate; -#if defined (macintosh) && !defined (SDL) +#if defined (macintosh) && !defined (HAVE_SDL) typedef enum { music_normal, diff --git a/src/sdl/MakeNIX.cfg b/src/sdl/MakeNIX.cfg index 457f52301..f5c9b2075 100644 --- a/src/sdl/MakeNIX.cfg +++ b/src/sdl/MakeNIX.cfg @@ -30,6 +30,10 @@ ifdef NOTERMIOS endif endif +ifdef LINUX64 + OPTS+=-DLINUX64 +endif + # #here is Solaris # @@ -89,4 +93,4 @@ ifndef NOHW endif # name of the exefile - EXENAME?=lsdlsrb2 + EXENAME?=lsdl2srb2 diff --git a/src/sdl/Makefile.cfg b/src/sdl/Makefile.cfg index 1f9c7204f..3b92a9fb8 100644 --- a/src/sdl/Makefile.cfg +++ b/src/sdl/Makefile.cfg @@ -43,9 +43,9 @@ SDL_CFLAGS?=$(shell $(PKG_CONFIG) $(SDL_PKGCONFIG) --cflags) SDL_LDFLAGS?=$(shell $(PKG_CONFIG) $(SDL_PKGCONFIG) --libs) else ifdef PREFIX - SDL_CONFIG?=$(PREFIX)-sdl-config + SDL_CONFIG?=$(PREFIX)-sdl2-config else - SDL_CONFIG?=sdl-config + SDL_CONFIG?=sdl2-config endif ifdef STATIC @@ -67,7 +67,7 @@ endif OBJS+=$(OBJDIR)/i_video.o $(OBJDIR)/dosstr.o $(OBJDIR)/endtxt.o $(OBJDIR)/hwsym_sdl.o - OPTS+=-DDIRECTFULLSCREEN -DSDL + OPTS+=-DDIRECTFULLSCREEN -DHAVE_SDL ifndef NOHW OBJS+=$(OBJDIR)/r_opengl.o $(OBJDIR)/ogl_sdl.o @@ -95,33 +95,28 @@ endif endif endif -ifdef FILTERS - OBJS+=$(OBJDIR)/filters.o $(OBJDIR)/hq2x.o $(OBJDIR)/lq2x.o - OPTS+=-DHAVE_FILTER -endif - ifdef NOMIXER i_sound_o=$(OBJDIR)/sdl_sound.o else i_sound_o=$(OBJDIR)/mixer_sound.o OPTS+=-DHAVE_MIXER - SDL_LDFLAGS+=-lSDL_mixer + SDL_LDFLAGS+=-lSDL2_mixer endif ifdef SDL_TTF OPTS+=-DHAVE_TTF - SDL_LDFLAGS+=-lSDL_ttf -lfreetype -lz + SDL_LDFLAGS+=-lSDL2_ttf -lfreetype -lz OBJS+=$(OBJDIR)/i_ttf.o endif -#ifdef SDL_IMAGE -# OPTS+=-DHAVE_IMAGE -# SDL_LDFLAGS+=-lSDL_image -#endif +ifdef SDL_IMAGE + OPTS+=-DHAVE_IMAGE + SDL_LDFLAGS+=-lSDL2_image +endif ifdef SDL_NET OPTS+=-DHAVE_SDLNET - SDL_LDFLAGS+=-lSDL_net + SDL_LDFLAGS+=-lSDL2_net endif ifdef SDLMAIN diff --git a/src/sdl/Srb2SDL-vc10.vcxproj b/src/sdl/Srb2SDL-vc10.vcxproj index 192f19156..7e25b5ad9 100644 --- a/src/sdl/Srb2SDL-vc10.vcxproj +++ b/src/sdl/Srb2SDL-vc10.vcxproj @@ -74,14 +74,14 @@ .\..\..\bin\VC10\$(Platform)\$(Configuration)\ .\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\ false - $(SDL12_PREFIX)\include;$(SDL12_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath) - $(SDL12_PREFIX)\include;$(SDL12_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath) - $(SDL12_PREFIX)\include;$(SDL12_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath) - $(SDL12_PREFIX)\include;$(SDL12_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath) - $(SDL12_PREFIX)\lib;$(SDL12_MIXER_PREFIX)\lib;$(LibraryPath) - $(SDL12_PREFIX)\lib;$(SDL12_MIXER_PREFIX)\lib;$(LibraryPath) - $(SDL12_PREFIX)\lib\x64;$(SDL12_MIXER_PREFIX)\lib\x64;$(LibraryPath) - $(SDL12_PREFIX)\lib\x64;$(SDL12_MIXER_PREFIX)\lib\x64;$(LibraryPath) + $(SDL20_PREFIX)\include;$(SDL20_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath) + $(SDL20_PREFIX)\include;$(SDL20_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath) + $(SDL20_PREFIX)\include;$(SDL20_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath) + $(SDL20_PREFIX)\include;$(SDL20_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath) + $(SDL20_PREFIX)\lib;$(SDL20_MIXER_PREFIX)\lib;$(LibraryPath) + $(SDL20_PREFIX)\lib;$(SDL20_MIXER_PREFIX)\lib;$(LibraryPath) + $(SDL20_PREFIX)\lib\x64;$(SDL20_MIXER_PREFIX)\lib\x64;$(LibraryPath) + $(SDL20_PREFIX)\lib\x64;$(SDL20_MIXER_PREFIX)\lib\x64;$(LibraryPath) @@ -96,7 +96,7 @@ Disabled $(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories) - _DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + _DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug @@ -145,7 +145,7 @@ Disabled $(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories) - _DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + _DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug @@ -202,7 +202,7 @@ Speed true $(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories) - NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) true MultiThreaded .\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch @@ -258,7 +258,7 @@ Speed true $(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories) - NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) true MultiThreaded .\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch @@ -1461,4 +1461,4 @@ - \ No newline at end of file + diff --git a/src/sdl/Srb2SDL-vc9.vcproj b/src/sdl/Srb2SDL-vc9.vcproj index 620202bdf..d2a268f8d 100644 --- a/src/sdl/Srb2SDL-vc9.vcproj +++ b/src/sdl/Srb2SDL-vc9.vcproj @@ -50,7 +50,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=""$(ProjectDir)..\..\libs\libpng-src";"$(ProjectDir)..\..\libs\zlib"" - PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE" + PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="1" @@ -145,7 +145,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=""$(ProjectDir)..\..\libs\libpng-src";"$(ProjectDir)..\..\libs\zlib"" - PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE" + PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="1" @@ -248,7 +248,7 @@ FavorSizeOrSpeed="1" OmitFramePointers="true" AdditionalIncludeDirectories=""$(ProjectDir)..\..\libs\libpng-src";"$(ProjectDir)..\..\libs\zlib"" - PreprocessorDefinitions="NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE" + PreprocessorDefinitions="NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE" StringPooling="true" RuntimeLibrary="0" PrecompiledHeaderFile=".\..\..\objs\VC9\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch" @@ -350,7 +350,7 @@ FavorSizeOrSpeed="1" OmitFramePointers="true" AdditionalIncludeDirectories=""$(ProjectDir)..\..\libs\libpng-src";"$(ProjectDir)..\..\libs\zlib"" - PreprocessorDefinitions="NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE" + PreprocessorDefinitions="NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE" StringPooling="true" RuntimeLibrary="0" PrecompiledHeaderFile=".\..\..\objs\VC9\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch" diff --git a/src/sdl/Srb2SDL.dsp b/src/sdl/Srb2SDL.dsp index 02c3b2701..879113ca2 100644 --- a/src/sdl/Srb2SDL.dsp +++ b/src/sdl/Srb2SDL.dsp @@ -45,7 +45,7 @@ MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G5 /W3 /GX /Zi /Ot /Og /Oi /Op /Oy /Ob1 /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "NDEBUG" /D "SDLMAIN" /D "NO_STDIO_REDIRECT" /D "USE_WGL_SWAP" /D "DIRECTFULLSCREEN" /D "SDL" /D "HWRENDER" /D "HW3SOUND" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GF /c +# ADD CPP /nologo /G5 /W3 /GX /Zi /Ot /Og /Oi /Op /Oy /Ob1 /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "NDEBUG" /D "SDLMAIN" /D "NO_STDIO_REDIRECT" /D "USE_WGL_SWAP" /D "DIRECTFULLSCREEN" /D "HAVE_SDL" /D "HWRENDER" /D "HW3SOUND" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GF /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" # SUBTRACT RSC /x @@ -72,7 +72,7 @@ LINK32=link.exe # PROP Target_Dir "" MTL=midl.exe # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /G6 /W4 /WX /Gm /GX /ZI /Od /Op /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "_DEBUG" /D "USE_WGL_SWAP" /D "DIRECTFULLSCREEN" /D "SDL" /D "HWRENDER" /D "HW3SOUND" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GZ /c +# ADD CPP /nologo /G6 /W4 /WX /Gm /GX /ZI /Od /Op /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "_DEBUG" /D "USE_WGL_SWAP" /D "DIRECTFULLSCREEN" /D "HAVE_SDL" /D "HWRENDER" /D "HW3SOUND" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GZ /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" diff --git a/src/sdl/hwsym_sdl.c b/src/sdl/hwsym_sdl.c index 43c71f7bf..44ddf830c 100644 --- a/src/sdl/hwsym_sdl.c +++ b/src/sdl/hwsym_sdl.c @@ -29,7 +29,7 @@ #pragma warning(disable : 4214 4244) #endif -#ifdef SDL +#ifdef HAVE_SDL #include "SDL.h" diff --git a/src/sdl/i_cdmus.c b/src/sdl/i_cdmus.c index adab39c90..fc35eb9cf 100644 --- a/src/sdl/i_cdmus.c +++ b/src/sdl/i_cdmus.c @@ -1,588 +1,38 @@ -// 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 -/// - -#ifdef SDL - -#if defined (DC) || defined (_WIN32_WCE) || defined(GP2X) || defined(_PS3) -#define NOSDLCD -#endif - -#include -#ifndef NOSDLCD - -#ifdef _MSC_VER -#pragma warning(disable : 4214 4244) -#endif - -#include "SDL.h" - -#ifdef _MSC_VER -#pragma warning(default : 4214 4244) -#endif - -#endif - -#include "../doomtype.h" -#include "../i_sound.h" #include "../command.h" -#include "../m_argv.h" #include "../s_sound.h" +#include "../i_sound.h" -#define MAX_CD_TRACKS 256 +// +// CD MUSIC I/O +// -#ifdef _XBOX -INT32 SDL_SYS_CDInit(void) -{ - return(0); -} - -void SDL_SYS_CDQuit(void) -{ - return; -} -#endif - -UINT8 cdaudio_started = 0; // for system startup/shutdown +UINT8 cdaudio_started = 0; consvar_t cd_volume = {"cd_volume","31",CV_SAVE,soundvolume_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cdUpdate = {"cd_update","1",CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; -#ifndef NOSDLCD -static SDL_bool cdValid = SDL_FALSE; -static SDL_bool cdPlaying = SDL_FALSE; -static SDL_bool wasPlaying = SDL_FALSE; -static SDL_bool cdEnabled = SDL_FALSE; -static SDL_bool playLooping = SDL_FALSE; -static Uint8 playTrack = 0; -static Uint8 maxTrack = MAX_CD_TRACKS-1; -static Uint8 cdRemap[MAX_CD_TRACKS]; -static INT32 cdvolume = -1; -static SDL_CD *cdrom = NULL; -static CDstatus cdStatus = CD_ERROR; -/************************************************************************** - * - * function: CDAudio_GetAudioDiskInfo - * - * description: - * set number of tracks if CD is available - * - **************************************************************************/ -static INT32 CDAudio_GetAudioDiskInfo(void) +void I_InitCD(void){} + +void I_StopCD(void){} + +void I_PauseCD(void){} + +void I_ResumeCD(void){} + +void I_ShutdownCD(void){} + +void I_UpdateCD(void){} + +void I_PlayCD(UINT8 track, UINT8 looping) { - cdValid = SDL_FALSE; - maxTrack = 0; - - if (!cdrom) - return 0;//Alam: Lies! - - cdStatus = SDL_CDStatus(cdrom); - - if (!CD_INDRIVE(cdStatus)) - { - CONS_Printf("%s", M_GetText("No CD in drive\n")); - return -1; - } - - if (cdStatus == CD_ERROR) - { - CONS_Printf(M_GetText("CD Error: %s\n"), SDL_GetError()); - return -1; - } - - cdValid = SDL_TRUE; - maxTrack = (Uint8)cdrom->numtracks; - - return 0; -} - - -/************************************************************************** - * - * function: I_EjectCD - * - * description: - * - * - **************************************************************************/ -static void I_EjectCD(void) -{ - if (!cdrom || !cdEnabled) - return; // no cd init'd - - I_StopCD(); - - if (SDL_CDEject(cdrom)) - CONS_Printf("%s", M_GetText("CD eject failed\n")); -} - -/************************************************************************** - * - * function: Command_Cd_f - * - * description: - * handles all CD commands from the console - * - **************************************************************************/ -static void Command_Cd_f (void) -{ - const char *command; - size_t ret, n; - - if (!cdaudio_started) - return; - - if (COM_Argc() < 2) - { - CONS_Printf ("%s", M_GetText("cd [on] [off] [remap] [reset] [select]\n" - " [open] [info] [play ] [resume]\n" - " [stop] [pause] [loop ]\n")); - return; - } - - command = COM_Argv (1); - - if (!strncmp(command, "on", 2)) - { - cdEnabled = SDL_TRUE; - return; - } - - if (!strncmp(command, "off", 3)) - { - I_StopCD(); - cdEnabled = SDL_FALSE; - return; - } - - if (!strncmp(command, "select", 6)) - { - INT32 newcddrive; - newcddrive = atoi(COM_Argv(2)); - command = SDL_CDName(newcddrive); - I_StopCD(); - cdEnabled = SDL_FALSE; - SDL_CDClose(cdrom); - cdrom = SDL_CDOpen(newcddrive); - if (cdrom) - { - cdEnabled = SDL_TRUE; - CONS_Printf(M_GetText("Opened CD-ROM drive %s\n"), command ? command : COM_Argv(2)); - } - else CONS_Printf(M_GetText("Couldn't open CD-ROM drive %s: %s\n"), command ? command : COM_Argv(2), SDL_GetError()); - return; - } - - if (!strncmp(command, "remap", 5)) - { - ret = COM_Argc() - 2; - if (ret <= 0) - { - for (n = 1; n < MAX_CD_TRACKS; n++) - { - if (cdRemap[n] != n) - CONS_Printf(" %s -> %u\n", sizeu1(n), cdRemap[n]); - } - return; - } - for (n = 1; n <= ret; n++) - cdRemap[n] = (Uint8)atoi(COM_Argv (n+1)); - return; - } - - if (!strncmp(command, "reset", 5)) - { - if (!cdrom) return; - cdEnabled = SDL_TRUE; - I_StopCD(); - for (n = 0; n < MAX_CD_TRACKS; n++) - cdRemap[n] = (Uint8)n; - CDAudio_GetAudioDiskInfo(); - return; - } - - if (!cdValid) - { - if (CDAudio_GetAudioDiskInfo()==-1 && !cdValid) - { - CONS_Printf("%s", M_GetText("No CD in drive\n")); - return; - } - } - - if (!strncmp(command, "open", 4)) - { - I_EjectCD(); - cdValid = SDL_FALSE; - return; - } - - if (!strncmp(command, "info", 4)) - { - CONS_Printf(M_GetText("%u tracks\n"), maxTrack); - if (cdPlaying) - CONS_Printf(M_GetText("Currently %s track %u\n"), playLooping ? M_GetText("looping") : M_GetText("playing"), playTrack); - else if (wasPlaying) - CONS_Printf(M_GetText("Paused %s track %u\n"), playLooping ? M_GetText("looping") : M_GetText("playing"), playTrack); - CONS_Printf(M_GetText("Volume is %d\n"), cdvolume); - return; - } - - if (!strncmp(command, "play", 4)) - { - I_PlayCD((UINT8)atoi(COM_Argv (2)), SDL_FALSE); - return; - } - - if (!strncmp(command, "loop", 4)) - { - I_PlayCD((UINT8)atoi(COM_Argv (2)), true); - return; - } - - if (!strncmp(command, "stop", 4)) - { - I_StopCD(); - return; - } - if (!strncmp(command, "pause", 5)) - { - I_PauseCD(); - return; - } - - if (!strncmp(command, "resume", 6)) - { - I_ResumeCD(); - return; - } - - CONS_Printf(M_GetText("Invalid CD command \"CD %s\"\n"), COM_Argv(1)); -} -#endif - -/************************************************************************** - * - * function: StopCD - * - * description: - * - * - **************************************************************************/ -void I_StopCD(void) -{ -#ifndef NOSDLCD - if (!cdrom || !cdEnabled) - return; - - if (!(cdPlaying || wasPlaying)) - return; - - if (SDL_CDStop(cdrom)) - I_OutputMsg("cdromstop failed\n"); - - wasPlaying = SDL_FALSE; - cdPlaying = SDL_FALSE; -#endif -} - -/************************************************************************** - * - * function: PauseCD - * - * description: - * - * - **************************************************************************/ -void I_PauseCD (void) -{ -#ifndef NOSDLCD - if (!cdrom || !cdEnabled) - return; - - if (!cdPlaying) - return; - - if (SDL_CDPause(cdrom)) - I_OutputMsg("cdrompause failed\n"); - - wasPlaying = cdPlaying; - cdPlaying = SDL_FALSE; -#endif -} - -/************************************************************************** - * - * function: ResumeCD - * - * description: - * - * - **************************************************************************/ -// continue after a pause -void I_ResumeCD (void) -{ -#ifndef NOSDLCD - if (!cdrom || !cdEnabled) - return; - - if (!cdValid) - return; - - if (!wasPlaying) - return; - - if (cd_volume.value == 0) - return; - - if (SDL_CDResume(cdrom)) - I_OutputMsg("cdromresume failed\n"); - - cdPlaying = SDL_TRUE; - wasPlaying = SDL_FALSE; -#endif -} - - -/************************************************************************** - * - * function: ShutdownCD - * - * description: - * - * - **************************************************************************/ -void I_ShutdownCD (void) -{ -#ifndef NOSDLCD - if (!cdaudio_started) - return; - - I_StopCD(); - - CONS_Printf("I_ShutdownCD: "); - SDL_CDClose(cdrom); - cdrom = NULL; - cdaudio_started = false; - CONS_Printf("%s", M_GetText("shut down\n")); - SDL_QuitSubSystem(SDL_INIT_CDROM); - cdEnabled = SDL_FALSE; -#endif -} - -/************************************************************************** - * - * function: InitCD - * - * description: - * Initialize the first CD drive SDL detects and add console command 'cd' - * - **************************************************************************/ -void I_InitCD (void) -{ -#ifndef NOSDLCD - INT32 i; - - // Has been checked in d_main.c, but doesn't hurt here - if (M_CheckParm ("-nocd")) - return; - - CONS_Printf("%s", M_GetText("I_InitCD: Init CD audio\n")); - - // Initialize SDL first - if (SDL_InitSubSystem(SDL_INIT_CDROM) < 0) - { - CONS_Printf(M_GetText("Couldn't initialize SDL CDROM: %s\n"), SDL_GetError()); - return; - } - - // Open drive - cdrom = SDL_CDOpen(0); - - if (!cdrom) - { - const char *cdName = SDL_CDName(0); - if (!cdName) - CONS_Printf(M_GetText("Couldn't open CD-ROM drive %s: %s\n"), "\b", SDL_GetError()); - else - CONS_Printf(M_GetText("Couldn't open CD-ROM drive %s: %s\n"), cdName, SDL_GetError()); - //return; - } - - for (i = 0; i < MAX_CD_TRACKS; i++) - cdRemap[i] = (Uint8)i; - - cdaudio_started = true; - if (cdrom) cdEnabled = SDL_TRUE; - - if (CDAudio_GetAudioDiskInfo()==-1) - { - CONS_Printf("%s", M_GetText("No CD in drive\n")); - cdValid = SDL_FALSE; - } - - COM_AddCommand ("cd", Command_Cd_f); - - CONS_Printf("%s", M_GetText("CD audio Initialized\n")); -#endif -} - - - -// -/************************************************************************** - * - * function: UpdateCD - * - * description: - * sets CD volume (may have changed) and initiates play evey 2 seconds - * in case the song has elapsed - * - **************************************************************************/ -void I_UpdateCD (void) -{ -#ifndef NOSDLCD - static Uint32 lastchk = 0; - - if (!cdEnabled || !cdrom) - return; - - I_SetVolumeCD(cd_volume.value); - - if (cdPlaying && lastchk < SDL_GetTicks()) - { - lastchk = SDL_GetTicks() + 2000; //two seconds between chks - - if (CDAudio_GetAudioDiskInfo()==-1) - { - cdPlaying = SDL_FALSE; - return; - } - - if (cdStatus != CD_PLAYING && cdStatus != CD_PAUSED) - { - cdPlaying = SDL_FALSE; - if (playLooping) - I_PlayCD(playTrack, true); - } - } -#endif -} - - - -/************************************************************************** - * - * function: PlayCD - * - * description: - * play the requested track and set the looping flag - * pauses the CD if volume is 0 - * - **************************************************************************/ - -void I_PlayCD (UINT8 track, UINT8 looping) -{ -#ifdef NOSDLCD (void)track; (void)looping; -#else - if (!cdrom || !cdEnabled) - return; - - if (!cdValid) - { - CDAudio_GetAudioDiskInfo(); - if (!cdValid) - return; - } - - track = cdRemap[track]; - - if (track < 1 || track > maxTrack) - { - CONS_Printf(M_GetText("Bad track number %u.\n"), track); - return; - } - - // don't try to play a non-audio track - if (cdrom->track[track].type == SDL_DATA_TRACK) - { - CONS_Printf(M_GetText("Track %u is not audio\n"), track); - return; - } - - if (cdPlaying) - { - if (playTrack == track) - return; - I_StopCD(); - } - - if (SDL_CDPlayTracks(cdrom, track, 0, 1, 0)) - { - CONS_Printf(M_GetText("Error playing track %d: %s\n"), track, SDL_GetError()); - return; - } - - playLooping = looping; - playTrack = (Uint8)track; - cdPlaying = SDL_TRUE; - - if (cd_volume.value == 0) - I_PauseCD(); -#endif } - -/************************************************************************** - * - * function: SetVolumeCD - * - * description: - * SDL does not support setting the CD volume - * use pause instead and toggle between full and no music - * - **************************************************************************/ - -boolean I_SetVolumeCD (INT32 volume) +boolean I_SetVolumeCD(int volume) { -#ifdef NOSDLCD (void)volume; -#else - if (volume != cdvolume) - { - if (volume > 0 && volume < 16) - { - CV_SetValue(&cd_volume, 31); - cdvolume = 31; - I_ResumeCD(); - } - else if (volume > 15 && volume < 31) - { - CV_SetValue(&cd_volume, 0); - cdvolume = 0; - I_PauseCD(); - } - } -#endif return false; } -#endif diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index 85abb7041..1c438e083 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -48,7 +48,7 @@ PSP_MAIN_THREAD_NAME("SRB2"); PSP_MAIN_THREAD_STACK_SIZE_KB(256); #endif -#ifdef SDL +#ifdef HAVE_SDL #ifdef HAVE_TTF #include "SDL.h" diff --git a/src/sdl/i_net.c b/src/sdl/i_net.c index c31935acf..ee4a34c13 100644 --- a/src/sdl/i_net.c +++ b/src/sdl/i_net.c @@ -32,7 +32,7 @@ #include "../i_tcp.h" -#ifdef SDL +#ifdef HAVE_SDL #ifdef HAVE_SDLNET diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 1e03edd88..cfc2e210d 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -73,7 +73,7 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s? #pragma warning(disable : 4214 4244) #endif -#ifdef SDL +#ifdef HAVE_SDL #include "SDL.h" @@ -996,8 +996,8 @@ void I_GetJoystickEvents(void) UINT64 joyhats = 0; #if 0 UINT64 joybuttons = 0; - Sint16 axisx, axisy; #endif + Sint16 axisx, axisy; if (!joystick_started) return; @@ -1070,7 +1070,6 @@ void I_GetJoystickEvents(void) } } -#if 0 // send joystick axis positions event.type = ev_joystick; @@ -1123,7 +1122,6 @@ void I_GetJoystickEvents(void) } D_PostEvent(&event); } -#endif } /** \brief Open joystick handle @@ -1156,7 +1154,7 @@ static int joy_open(const char *fname) { CONS_Printf(M_GetText("Cannot use joystick #%d/(%s), it doesn't exist\n"),joyindex,fname); for (i = 0; i < num_joy; i++) - CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickName(i)); + CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i)); I_ShutdownJoystick(); return -1; } @@ -1177,7 +1175,7 @@ static int joy_open(const char *fname) { CONS_Printf(M_GetText("Found %d joysticks on this system\n"), num_joy); for (i = 0; i < num_joy; i++) - CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickName(i)); + CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i)); } else CONS_Printf("%s", M_GetText("Found no joysticks on this system\n")); @@ -1185,7 +1183,6 @@ static int joy_open(const char *fname) } JoyInfo.dev = SDL_JoystickOpen(joyindex-1); - CONS_Printf(M_GetText("Joystick: %s\n"), SDL_JoystickName(joyindex-1)); if (JoyInfo.dev == NULL) { @@ -1195,6 +1192,7 @@ static int joy_open(const char *fname) } else { + CONS_Printf(M_GetText("Joystick: %s\n"), SDL_JoystickName(JoyInfo.dev)); JoyInfo.axises = SDL_JoystickNumAxes(JoyInfo.dev); if (JoyInfo.axises > JOYAXISSET*2) JoyInfo.axises = JOYAXISSET*2; @@ -1219,7 +1217,7 @@ static int joy_open(const char *fname) JoyInfo.balls = SDL_JoystickNumBalls(JoyInfo.dev); #endif - //Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(SDL_JoystickIndex(JoyInfo.dev)), "pad"); + //Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(JoyInfo.dev), "pad"); return JoyInfo.axises; } @@ -1290,8 +1288,8 @@ void I_GetJoystick2Events(void) UINT64 joyhats = 0; #if 0 INT64 joybuttons = 0; - INT32 axisx, axisy; #endif + INT32 axisx, axisy; if (!joystick2_started) return; @@ -1361,7 +1359,6 @@ void I_GetJoystick2Events(void) } } -#if 0 // send joystick axis positions event.type = ev_joystick2; @@ -1416,7 +1413,6 @@ void I_GetJoystick2Events(void) } D_PostEvent(&event); } -#endif } @@ -1448,7 +1444,7 @@ static int joy_open2(const char *fname) { CONS_Printf(M_GetText("Cannot use joystick #%d/(%s), it doesn't exist\n"),joyindex,fname); for (i = 0; i < num_joy; i++) - CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickName(i)); + CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i)); I_ShutdownJoystick2(); return -1; } @@ -1469,7 +1465,7 @@ static int joy_open2(const char *fname) { CONS_Printf(M_GetText("Found %d joysticks on this system\n"), num_joy); for (i = 0; i < num_joy; i++) - CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickName(i)); + CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i)); } else CONS_Printf("%s", M_GetText("Found no joysticks on this system\n")); @@ -1477,7 +1473,6 @@ static int joy_open2(const char *fname) } JoyInfo2.dev = SDL_JoystickOpen(joyindex-1); - CONS_Printf(M_GetText("Joystick2: %s\n"), SDL_JoystickName(joyindex-1)); if (!JoyInfo2.dev) { @@ -1487,6 +1482,7 @@ static int joy_open2(const char *fname) } else { + CONS_Printf(M_GetText("Joystick2: %s\n"), SDL_JoystickName(JoyInfo2.dev)); JoyInfo2.axises = SDL_JoystickNumAxes(JoyInfo2.dev); if (JoyInfo2.axises > JOYAXISSET*2) JoyInfo2.axises = JOYAXISSET*2; @@ -1511,7 +1507,7 @@ static int joy_open2(const char *fname) JoyInfo2.balls = SDL_JoystickNumBalls(JoyInfo2.dev); #endif - //Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(SDL_JoystickIndex(JoyInfo2.dev)), "pad"); + //Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(JoyInfo2.dev), "pad"); return JoyInfo2.axises; } @@ -1582,11 +1578,11 @@ const char *I_GetJoyName(INT32 joyindex) if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0) { if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != -1) - joyname = SDL_JoystickName(joyindex); + joyname = SDL_JoystickNameForIndex(joyindex); SDL_QuitSubSystem(SDL_INIT_JOYSTICK); } else - joyname = SDL_JoystickName(joyindex); + joyname = SDL_JoystickNameForIndex(joyindex); return joyname; } @@ -2219,7 +2215,7 @@ void I_Sleep(void) INT32 I_StartupSystem(void) { SDL_version SDLcompiled; - const SDL_version *SDLlinked; + SDL_version SDLlinked; #ifdef _XBOX #ifdef __GNUC__ char DP[] =" Sonic Robo Blast 2!\n"; @@ -2240,12 +2236,12 @@ INT32 I_StartupSystem(void) #endif #endif SDL_VERSION(&SDLcompiled) - SDLlinked = SDL_Linked_Version(); + SDL_GetVersion(&SDLlinked); I_StartupConsole(); I_OutputMsg("Compiled for SDL version: %d.%d.%d\n", SDLcompiled.major, SDLcompiled.minor, SDLcompiled.patch); I_OutputMsg("Linked with SDL version: %d.%d.%d\n", - SDLlinked->major, SDLlinked->minor, SDLlinked->patch); + SDLlinked.major, SDLlinked.minor, SDLlinked.patch); #if 0 //#ifdef GP2X //start up everything if (SDL_Init(SDL_INIT_NOPARACHUTE|SDL_INIT_EVERYTHING) < 0) #else @@ -2875,7 +2871,7 @@ const char *I_LocateWad(void) return waddir; } -#ifdef LINUX +#if defined(LINUX) || defined(LINUX64) #define MEMINFO_FILE "/proc/meminfo" #define MEMTOTAL "MemTotal:" #define MEMFREE "MemFree:" @@ -2931,7 +2927,25 @@ UINT32 I_GetFreeMem(UINT32 *total) if (total) *total = 32 << 20; return 32 << 20; -#elif defined (LINUX) +#elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX) + MEMORYSTATUS info; + + info.dwLength = sizeof (MEMORYSTATUS); + GlobalMemoryStatus( &info ); + if (total) + *total = (UINT32)info.dwTotalPhys; + return (UINT32)info.dwAvailPhys; +#elif defined (__OS2__) + UINT32 pr_arena; + + if (total) + DosQuerySysInfo( QSV_TOTPHYSMEM, QSV_TOTPHYSMEM, + (PVOID) total, sizeof (UINT32)); + DosQuerySysInfo( QSV_MAXPRMEM, QSV_MAXPRMEM, + (PVOID) &pr_arena, sizeof (UINT32)); + + return pr_arena; +#elif defined (LINUX) || defined (LINUX64) /* Linux */ char buf[1024]; char *memTag; @@ -2975,24 +2989,6 @@ UINT32 I_GetFreeMem(UINT32 *total) if (total) *total = totalKBytes << 10; return freeKBytes << 10; -#elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX) - MEMORYSTATUS info; - - info.dwLength = sizeof (MEMORYSTATUS); - GlobalMemoryStatus( &info ); - if (total) - *total = (UINT32)info.dwTotalPhys; - return (UINT32)info.dwAvailPhys; -#elif defined (__OS2__) - UINT32 pr_arena; - - if (total) - DosQuerySysInfo( QSV_TOTPHYSMEM, QSV_TOTPHYSMEM, - (PVOID) total, sizeof (UINT32)); - DosQuerySysInfo( QSV_MAXPRMEM, QSV_MAXPRMEM, - (PVOID) &pr_arena, sizeof (UINT32)); - - return pr_arena; #else // Guess 48 MB. if (total) @@ -3039,8 +3035,8 @@ const CPUInfoFlags *I_CPUInfo(void) WIN_CPUInfo.SSE2 = SDL_HasSSE2(); WIN_CPUInfo.AltiVec = SDL_HasAltiVec(); } - WIN_CPUInfo.MMXExt = SDL_HasMMXExt(); - WIN_CPUInfo.AMD3DNowExt = SDL_Has3DNowExt(); + WIN_CPUInfo.MMXExt = SDL_FALSE; //SDL_HasMMXExt(); No longer in SDL2 + WIN_CPUInfo.AMD3DNowExt = SDL_FALSE; //SDL_Has3DNowExt(); No longer in SDL2 #endif GetSystemInfo(&SI); WIN_CPUInfo.CPUs = SI.dwNumberOfProcessors; @@ -3052,9 +3048,9 @@ const CPUInfoFlags *I_CPUInfo(void) memset(&SDL_CPUInfo,0,sizeof (CPUInfoFlags)); SDL_CPUInfo.RDTSC = SDL_HasRDTSC(); SDL_CPUInfo.MMX = SDL_HasMMX(); - SDL_CPUInfo.MMXExt = SDL_HasMMXExt(); + SDL_CPUInfo.MMXExt = SDL_FALSE; //SDL_HasMMXExt(); No longer in SDL2 SDL_CPUInfo.AMD3DNow = SDL_Has3DNow(); - SDL_CPUInfo.AMD3DNowExt = SDL_Has3DNowExt(); + SDL_CPUInfo.AMD3DNowExt = SDL_FALSE; //SDL_Has3DNowExt(); No longer in SDL2 SDL_CPUInfo.SSE = SDL_HasSSE(); SDL_CPUInfo.SSE2 = SDL_HasSSE2(); SDL_CPUInfo.AltiVec = SDL_HasAltiVec(); diff --git a/src/sdl/i_ttf.c b/src/sdl/i_ttf.c index 770a81d98..4a41f120e 100644 --- a/src/sdl/i_ttf.c +++ b/src/sdl/i_ttf.c @@ -16,7 +16,7 @@ /// \file /// \brief SDL_ttf interface code. Necessary for platforms with no framebuffer console systems. -#if defined(SDL) && defined(HAVE_TTF) +#if defined(HAVE_SDL) && defined(HAVE_TTF) #include "SDL.h" #include "SDL_ttf.h" #include "../doomdef.h" diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 1a2305fef..fd029832a 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -19,15 +19,13 @@ #include -#ifndef _WIN32_WCE #include -#endif #ifdef _MSC_VER #pragma warning(disable : 4214 4244) #endif -#ifdef SDL +#ifdef HAVE_SDL #include "SDL.h" @@ -35,16 +33,6 @@ #pragma warning(default : 4214 4244) #endif -#if SDL_VERSION_ATLEAST(1,2,9) && defined (_arch_dreamcast) -#define HAVE_DCSDL -#include "SDL_dreamcast.h" -#endif - -#if SDL_VERSION_ATLEAST(1,2,9) && defined (GP2X) -#define HAVE_GP2XSDL -#include "SDL_gp2x.h" -#endif - #if SDL_VERSION_ATLEAST(1,3,0) #define SDLK_EQUALS SDLK_KP_EQUALSAS400 #define SDLK_LMETA SDLK_LGUI @@ -59,10 +47,6 @@ #ifdef HAVE_IMAGE #include "SDL_image.h" -#elseif !(defined (DC) || defined (_WIN32_WCE) || defined (PSP) || defined(GP2X)) -#define LOAD_XPM //I want XPM! -#include "IMG_xpm.c" //Alam: I don't want to add SDL_Image.dll/so -#define HAVE_IMAGE //I have SDL_Image, sortof #endif #ifdef HAVE_IMAGE @@ -71,24 +55,10 @@ #include "../doomdef.h" -#if defined (_WIN32) && !defined (_XBOX) +#if defined (_WIN32) #include "SDL_syswm.h" #endif -#ifdef _arch_dreamcast -#include -#include -#include -//#include "SRB2DC/VMU.xbm" -//#include -//#define malloc pvr_mem_malloc -//#define free pvr_mem_free -#endif - -#if defined (_XBOX) && defined (__GNUC__) -#include -#endif - #include "../doomstat.h" #include "../i_system.h" #include "../v_video.h" @@ -112,27 +82,8 @@ #include "ogl_sdl.h" #endif -#ifdef REMOTE_DEBUGGING -#ifdef _WII -#include -#endif -#endif - -#ifdef HAVE_FILTER -#define FILTERS -#include "filter/filters.h" -#endif - // maximum number of windowed modes (see windowedModes[][]) -#if defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined(GP2X) -#define MAXWINMODES (1) -#elif defined (WII) -#define MAXWINMODES (8) -#elif defined (_PS3) -#define MAXWINMODES (26) -#else -#define MAXWINMODES (27) -#endif +#define MAXWINMODES (17) /** \brief */ @@ -147,11 +98,7 @@ rendermode_t rendermode=render_soft; boolean highcolor = false; // synchronize page flipping with screen refresh -#if defined(DC) || (defined(GP2X) && !defined(HAVE_GP2XSDL)) -consvar_t cv_vidwait = {"vid_wait", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -#else consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -#endif static consvar_t cv_stretch = {"stretch", "Off", CV_SAVE|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; UINT8 graphics_started = 0; // Is used in console.c and screen.c @@ -161,7 +108,7 @@ boolean allow_fullscreen = false; static SDL_bool disable_fullscreen = SDL_FALSE; #define USE_FULLSCREEN (disable_fullscreen||!allow_fullscreen)?0:cv_fullscreen.value static SDL_bool disable_mouse = SDL_FALSE; -#define USE_MOUSEINPUT (!disable_mouse && cv_usemouse.value && SDL_GetAppState() & SDL_APPACTIVE) +#define USE_MOUSEINPUT (!disable_mouse && cv_usemouse.value && havefocus) #define MOUSE_MENU false //(!disable_mouse && cv_usemouse.value && menuactive && !USE_FULLSCREEN) #define MOUSEBUTTONS_MAX MOUSEBUTTONS @@ -169,155 +116,175 @@ static SDL_bool disable_mouse = SDL_FALSE; static INT32 firstEntry = 0; // SDL vars -#ifndef HWRENDER //[segabor] !!! I had problem compiling this source with gcc 3.3 static SDL_Surface *vidSurface = NULL; -#endif static SDL_Surface *bufSurface = NULL; static SDL_Surface *icoSurface = NULL; static SDL_Color localPalette[256]; +#if 0 static SDL_Rect **modeList = NULL; -#ifdef DC -static Uint8 BitsPerPixel = 15; -#else static Uint8 BitsPerPixel = 16; #endif static Uint16 realwidth = BASEVIDWIDTH; static Uint16 realheight = BASEVIDHEIGHT; -#ifdef _WIN32_WCE -static const Uint32 surfaceFlagsW = SDL_HWPALETTE; //Can't handle WinCE changing sides -#else -static const Uint32 surfaceFlagsW = SDL_HWPALETTE/*|SDL_RESIZABLE*/; -#endif -#ifdef _PSP -static const Uint32 surfaceFlagsF = SDL_HWSURFACE|SDL_FULLSCREEN; -#else -static const Uint32 surfaceFlagsF = SDL_HWPALETTE|SDL_FULLSCREEN; -#endif +static const Uint32 surfaceFlagsW = 0/*|SDL_RESIZABLE*/; +static const Uint32 surfaceFlagsF = 0; static SDL_bool mousegrabok = SDL_TRUE; -#define HalfWarpMouse(x,y) SDL_WarpMouse((Uint16)(x/2),(Uint16)(y/2)) -#if defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined(GP2X) -static SDL_bool videoblitok = SDL_TRUE; -#else +#define HalfWarpMouse(x,y) SDL_WarpMouseInWindow(window, (Uint16)(x/2),(Uint16)(y/2)) static SDL_bool videoblitok = SDL_FALSE; -#endif static SDL_bool exposevideo = SDL_FALSE; +static SDL_bool usesdl2soft = SDL_FALSE; +static SDL_bool borderlesswindow = SDL_FALSE; + +// SDL2 vars +SDL_Window *window; +SDL_Renderer *renderer; +static SDL_Texture *texture; +static SDL_bool havefocus = SDL_TRUE; +static const char *fallback_resolution_name = "Fallback"; // windowed video modes from which to choose from. static INT32 windowedModes[MAXWINMODES][2] = { -#if !(defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined (GP2X)) -#ifndef WII -#ifndef _PS3 {1920,1200}, // 1.60,6.00 -#endif + {1920,1080}, // 1.66 {1680,1050}, // 1.60,5.25 - {1600,1200}, // 1.33,5.00 - {1600,1000}, // 1.60,5.00 - {1536,1152}, // 1.33,4.80 - {1536, 960}, // 1.60,4.80 + {1600, 900}, // 1.66 + {1366, 768}, // 1.66 {1440, 900}, // 1.60,4.50 - {1400,1050}, // 1.33,4.375 - {1400, 875}, // 1.60,4.375 - {1360, 850}, // 1.60,4.25 + {1280,1024}, // 1.33? {1280, 960}, // 1.33,4.00 {1280, 800}, // 1.60,4.00 + {1280, 720}, // 1.66 {1152, 864}, // 1.33,3.60 - {1120, 700}, // 1.60,3.50 {1024, 768}, // 1.33,3.20 - { 960, 720}, // 1.33,3.00 - { 960, 600}, // 1.60,3.00 { 800, 600}, // 1.33,2.50 - { 800, 500}, // 1.60,2.50 -#endif { 640, 480}, // 1.33,2.00 { 640, 400}, // 1.60,2.00 - { 576, 432}, // 1.33,1.80 - { 512, 384}, // 1.33,1.60 - { 416, 312}, // 1.33,1.30 - { 400, 300}, // 1.33,1.25 { 320, 240}, // 1.33,1.00 -#endif { 320, 200}, // 1.60,1.00 }; -static void SDLSetMode(INT32 width, INT32 height, INT32 bpp, Uint32 flags) +static void Impl_VideoSetupSDLBuffer(void); +static void Impl_VideoSetupBuffer(void); +static SDL_bool Impl_CreateWindow(SDL_bool fullscreen); +static void Impl_SetWindowName(const char *title); +static void Impl_SetWindowIcon(void); + +static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen) { - const char *SDLVD = I_GetEnv("SDL_VIDEODRIVER"); -#ifdef _WIN32_WCE - if (bpp < 16) - bpp = 16; // 256 mode poo -#endif -#ifdef _WII - bpp = 16; // 8-bit mode poo -#endif -#ifdef DC - if (bpp < 15) - bpp = 15; - height = 240; -#endif -#ifdef PSP - bpp = 16; -#endif -#ifdef GP2X - bpp = 16; -#ifdef HAVE_GP2XSDL - height = 240; -#endif -#endif -#ifdef FILTERS - bpp = Setupf2x(width, height, bpp); -#endif - if (SDLVD && strncasecmp(SDLVD,"glSDL",6) == 0) //for glSDL videodriver - vidSurface = SDL_SetVideoMode(width, height,0,SDL_DOUBLEBUF); -#ifdef _WII // don't want it to use HWSURFACE, so make it first here - else if (SDL_VideoModeOK(width, height, bpp, flags|SDL_SWSURFACE|SDL_DOUBLEBUF) >= bpp) // SDL Wii uses double buffering - vidSurface = SDL_SetVideoMode(width, height, bpp, flags|SDL_SWSURFACE|SDL_DOUBLEBUF); -#endif - else if (cv_vidwait.value && videoblitok && SDL_VideoModeOK(width, height, bpp, flags|SDL_HWSURFACE|SDL_DOUBLEBUF) >= bpp) - vidSurface = SDL_SetVideoMode(width, height, bpp, flags|SDL_HWSURFACE|SDL_DOUBLEBUF); - else if (videoblitok && SDL_VideoModeOK(width, height, bpp, flags|SDL_HWSURFACE) >= bpp) - vidSurface = SDL_SetVideoMode(width, height, bpp, flags|SDL_HWSURFACE); - else if (SDL_VideoModeOK(width, height, bpp, flags|SDL_SWSURFACE) >= bpp) - vidSurface = SDL_SetVideoMode(width, height, bpp, flags|SDL_SWSURFACE); - else return; - realwidth = (Uint16)width; - realheight = (Uint16)height; -#ifdef HAVE_DCSDL - //SDL_DC_SetWindow(320,200); - SDL_DC_EmulateMouse(SDL_FALSE); - SDL_DC_EmulateKeyboard(SDL_TRUE); -#endif -#ifdef HAVE_GP2XSDL - SDL_ShowCursor(SDL_DISABLE); //For GP2X Open2x -#endif -#ifdef FILTERS - if (vidSurface && preSurface && f2xSurface) + static SDL_bool wasfullscreen = SDL_FALSE; + static SDL_bool glfallbackresolution = SDL_FALSE; + Uint32 rmask; + Uint32 gmask; + Uint32 bmask; + Uint32 amask; + int bpp = 16; + int sw_texture_format = SDL_PIXELFORMAT_ABGR8888; + + realwidth = vid.width; + realheight = vid.height; + + if (window) { - vid.width = width/2; - vid.height = height/2; + if (fullscreen) + { + wasfullscreen = SDL_TRUE; + SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP); + } + else if (!fullscreen && wasfullscreen) + { + wasfullscreen = SDL_FALSE; + glfallbackresolution = SDL_FALSE; + SDL_SetWindowFullscreen(window, 0); + SDL_SetWindowSize(window, width, height); + SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED); + } + else if (!wasfullscreen) + { + // Reposition window only in windowed mode + SDL_SetWindowSize(window, width, height); + SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED); + } + } + else + { + Impl_CreateWindow(fullscreen); + Impl_SetWindowIcon(); + wasfullscreen = fullscreen; + SDL_SetWindowSize(window, width, height); + if (fullscreen) + { + SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP); + } + } + + if (rendermode == render_opengl) + { + int sdlw, sdlh; + SDL_GetWindowSize(window, &sdlw, &sdlh); + // Logical fullscreen is not implemented yet for OpenGL, so... + // Special case handling + if (glfallbackresolution == SDL_FALSE && fullscreen && width != sdlw && height != sdlh) + { + if (VID_GetModeForSize(sdlw, sdlh) != -1) + { + wasfullscreen = SDL_TRUE; + VID_SetMode(VID_GetModeForSize(sdlw, sdlh)); + return; + } + else + { + wasfullscreen = SDL_TRUE; + glfallbackresolution = SDL_TRUE; + VID_SetMode(-1); + return; + } + } + OglSdlSurface(vid.width, vid.height); + } + + if (rendermode == render_soft) + { + SDL_RenderClear(renderer); + SDL_RenderSetLogicalSize(renderer, width, height); + // Set up Texture + realwidth = width; + realheight = height; + if (texture != NULL) + { + SDL_DestroyTexture(texture); + } + + if (!usesdl2soft) + { + sw_texture_format = SDL_PIXELFORMAT_RGB565; + } + else + { + bpp = 32; + sw_texture_format = SDL_PIXELFORMAT_RGBA8888; + } + + texture = SDL_CreateTexture(renderer, sw_texture_format, SDL_TEXTUREACCESS_STREAMING, width, height); + + // Set up SW surface + if (vidSurface != NULL) + { + SDL_FreeSurface(vidSurface); + } + SDL_PixelFormatEnumToMasks(sw_texture_format, &bpp, &rmask, &gmask, &bmask, &amask); + vidSurface = SDL_CreateRGBSurface(0, width, height, bpp, rmask, gmask, bmask, amask); } -#endif } // // Translates the SDL key into SRB2 key // -static INT32 SDLatekey(SDLKey sym) +static INT32 SDLatekey(SDL_Keycode sym) { INT32 rc = sym + 0x80; -#ifdef _WIN32_WCE - if (sym == SDLK_KP8) - sym = SDLK_UP; - else if (sym == SDLK_KP4) - sym = SDLK_LEFT; - else if (sym == SDLK_KP6) - sym = SDLK_RIGHT; - else if (sym == SDLK_KP2) - sym = SDLK_DOWN; -#endif - switch (sym) { case SDLK_LEFT: @@ -430,10 +397,10 @@ static INT32 SDLatekey(SDLKey sym) rc = KEY_RALT; break; - case SDLK_NUMLOCK: + case SDLK_NUMLOCKCLEAR: rc = KEY_NUMLOCK; break; - case SDLK_SCROLLOCK: + case SDLK_SCROLLLOCK: rc = KEY_SCROLLLOCK; break; @@ -453,34 +420,34 @@ static INT32 SDLatekey(SDLKey sym) rc = KEY_INS; break; - case SDLK_KP0: + case SDLK_KP_0: rc = KEY_KEYPAD0; break; - case SDLK_KP1: + case SDLK_KP_1: rc = KEY_KEYPAD1; break; - case SDLK_KP2: + case SDLK_KP_2: rc = KEY_KEYPAD2; break; - case SDLK_KP3: + case SDLK_KP_3: rc = KEY_KEYPAD3; break; - case SDLK_KP4: + case SDLK_KP_4: rc = KEY_KEYPAD4; break; - case SDLK_KP5: + case SDLK_KP_5: rc = KEY_KEYPAD5; break; - case SDLK_KP6: + case SDLK_KP_6: rc = KEY_KEYPAD6; break; - case SDLK_KP7: + case SDLK_KP_7: rc = KEY_KEYPAD7; break; - case SDLK_KP8: + case SDLK_KP_8: rc = KEY_KEYPAD8; break; - case SDLK_KP9: + case SDLK_KP_9: rc = KEY_KEYPAD9; break; @@ -500,24 +467,16 @@ static INT32 SDLatekey(SDLKey sym) rc = KEY_PLUSPAD; break; -#ifndef _arch_dreamcast - case SDLK_LSUPER: -#ifdef HAVE_SDLMETAKEYS case SDLK_LMETA: -#endif rc = KEY_LEFTWIN; break; - case SDLK_RSUPER: -#ifdef HAVE_SDLMETAKEYS case SDLK_RMETA: -#endif rc = KEY_RIGHTWIN; break; case SDLK_MENU: rc = KEY_MENU; break; -#endif default: if (sym >= SDLK_SPACE && sym <= SDLK_DELETE) @@ -537,16 +496,15 @@ static INT32 SDLatekey(SDLKey sym) static void SDLdoUngrabMouse(void) { - if (SDL_GRAB_ON == SDL_WM_GrabInput(SDL_GRAB_QUERY)) - { - SDL_WM_GrabInput(SDL_GRAB_OFF); - } + SDL_SetWindowGrab(window, SDL_FALSE); } void SDLforceUngrabMouse(void) { - if (SDL_WasInit(SDL_INIT_VIDEO)==SDL_INIT_VIDEO) - SDL_WM_GrabInput(SDL_GRAB_OFF); + if (SDL_WasInit(SDL_INIT_VIDEO)==SDL_INIT_VIDEO && window != NULL) + { + SDL_SetWindowGrab(window, SDL_FALSE); + } } static void VID_Command_NumModes_f (void) @@ -556,6 +514,11 @@ static void VID_Command_NumModes_f (void) static void SurfaceInfo(const SDL_Surface *infoSurface, const char *SurfaceText) { +#if 1 + (void)infoSurface; + (void)SurfaceText; + SDL2STUB(); +#else INT32 vfBPP; const SDL_Surface *VidSur = SDL_GetVideoSurface(); @@ -612,11 +575,15 @@ static void SurfaceInfo(const SDL_Surface *infoSurface, const char *SurfaceText) CONS_Printf("%s", M_GetText(" Colorkey RLE acceleration blit\n")); if (infoSurface->flags&SDL_SRCALPHA) CONS_Printf("%s", M_GetText(" Use alpha blending acceleration blit\n")); - +#endif } static void VID_Command_Info_f (void) { +#if 0 + SDL2STUB(); +#else +#if 0 const SDL_VideoInfo *videoInfo; videoInfo = SDL_GetVideoInfo(); //Alam: Double-Check if (videoInfo) @@ -652,16 +619,18 @@ static void VID_Command_Info_f (void) CONS_Printf("%s", M_GetText(" There no video memory for SDL\n")); //*vfmt } - SurfaceInfo(bufSurface, M_GetText("Current Engine Mode")); -#ifdef FILTERS - SurfaceInfo(preSurface, M_GetText("Prebuffer Mode")); - SurfaceInfo(f2xSurface, M_GetText("Postbuffer Mode")); +#else + if (!M_CheckParm("-noblit")) videoblitok = SDL_TRUE; #endif + SurfaceInfo(bufSurface, M_GetText("Current Engine Mode")); SurfaceInfo(vidSurface, M_GetText("Current Video Mode")); +#endif } static void VID_Command_ModeList_f(void) { + SDL2STUB(); +#if 0 #if !defined (DC) && !defined (_WIN32_WCE) && !defined (_PSP) && !defined(GP2X) INT32 i; #ifdef HWRENDER @@ -697,10 +666,13 @@ static void VID_Command_ModeList_f(void) } CONS_Printf("%s", M_GetText("None\n")); #endif +#endif } static void VID_Command_Mode_f (void) { + SDL2STUB(); +#if 0 INT32 modenum; if (COM_Argc()!= 2) @@ -715,9 +687,11 @@ static void VID_Command_Mode_f (void) CONS_Printf(M_GetText("Video mode not present\n")); else setmodeneeded = modenum+1; // request vid mode change +#endif } -#if defined(RPC_NO_WINDOWS_H) && !defined(_WIN32_WCE) +#if 0 +#if defined(RPC_NO_WINDOWS_H) static VOID MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(hWnd); @@ -731,237 +705,17 @@ static VOID MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } } #endif - -#if 0 //#ifdef _WIN32 - // 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 static inline void SDLJoyRemap(event_t *event) { -#if defined(GP2X) -#define GP2X_BUTTON_UP (0) -#define GP2X_BUTTON_DOWN (4) -#define GP2X_BUTTON_LEFT (2) -#define GP2X_BUTTON_RIGHT (6) -#define GP2X_BUTTON_UPLEFT (1) -#define GP2X_BUTTON_UPRIGHT (7) -#define GP2X_BUTTON_DOWNLEFT (3) -#define GP2X_BUTTON_DOWNRIGHT (5) -#define GP2X_BUTTON_CLICK (18) -#define GP2X_BUTTON_A (12) -#define GP2X_BUTTON_B (13) -#define GP2X_BUTTON_X (14) -#define GP2X_BUTTON_Y (15) -#define GP2X_BUTTON_L (10) -#define GP2X_BUTTON_R (11) -#define GP2X_BUTTON_START (8) -#define GP2X_BUTTON_SELECT (9) -#define GP2X_BUTTON_VOLUP (16) -#define GP2X_BUTTON_VOLDOWN (17) - if ((event->type == ev_keydown || event->type == ev_keyup) && (KEY_JOY1 <= event->data1 && event->data1 <= KEY_JOY1+JOYBUTTONS)) - { - INT32 button = event->data1-KEY_JOY1; - if (button <= 7) - { - static UINT8 DPAD = 0; - if (event->type == ev_keyup) - { - event->type = ev_console; - DPAD &= ~(1<type = ev_joystick; - DPAD |= 1<data2 = event->data3 = INT32_MAX; - if ((DPAD & (1<type = ev_joystick; - event->data2 = event->data3 = 0; - } - else switch (button) - { - case GP2X_BUTTON_UP: - event->data3 = -1; - break; - case GP2X_BUTTON_DOWN: - event->data3 = 1; - break; - case GP2X_BUTTON_LEFT: - event->data2 = -1; - break; - case GP2X_BUTTON_RIGHT: - event->data2 = 1; - break; - case GP2X_BUTTON_UPLEFT: - event->data2 = -1; - event->data3 = -1; - break; - case GP2X_BUTTON_UPRIGHT: - event->data2 = 1; - event->data3 = -1; - break; - case GP2X_BUTTON_DOWNLEFT: - event->data2 = -1; - event->data3 = 1; - break; - case GP2X_BUTTON_DOWNRIGHT: - event->data2 = 1; - event->data3 = 1; - default: - break; - } - event->data1 = 0; - return; - } - else switch (button) - { - case GP2X_BUTTON_CLICK: - event->data1 = KEY_ENTER; - break; - case GP2X_BUTTON_A: - event->data1 = KEY_JOY1+0; - break; - case GP2X_BUTTON_B: - event->data1 = KEY_JOY1+2; - break; - case GP2X_BUTTON_X: - event->data1 = KEY_JOY1+3; - break; - case GP2X_BUTTON_Y: - event->data1 = KEY_JOY1+1; - break; - case GP2X_BUTTON_L: - event->data1 = KEY_JOY1+4; - break; - case GP2X_BUTTON_R: - event->data1 = KEY_JOY1+5; - break; - case GP2X_BUTTON_START: - event->data1 = KEY_ESCAPE; - break; - case GP2X_BUTTON_SELECT: - event->data1 = KEY_JOY1+8; - break; - case GP2X_BUTTON_VOLUP: - event->data1 = KEY_JOY1+6; - break; - case GP2X_BUTTON_VOLDOWN: - event->data1 = KEY_JOY1+7; - break; - default: - break; - } - //I_OutputMsg("Button %i: event key %i and type: %i\n", button, event->data1, event->type); - } -#elif defined(_PSP) - if (event->data1 > KEY_JOY1 + 9 + 2) // All button after D-Pad and Select/Start - event->data1 -= 4; // remap D-pad to Hats, offset of -4 - else if (event->data1 == KEY_JOY1 + 6) // Down - event->data1 = KEY_HAT1+1; - else if (event->data1 == KEY_JOY1 + 7) // Left - event->data1 = KEY_HAT1+2; - else if (event->data1 == KEY_JOY1 + 8) // Up - event->data1 = KEY_HAT1+0; - else if (event->data1 == KEY_JOY1 + 9) // Right - event->data1 = KEY_HAT1+3; - else if (event->data1 == KEY_JOY1 + 10) // Select - event->data1 = KEY_TAB; - else if (event->data1 == KEY_JOY1 + 11) // Start - event->data1 = KEY_ESCAPE; -#else (void)event; -#endif } static INT32 SDLJoyAxis(const Sint16 axis, evtype_t which) { -#ifdef _arch_dreamcast // -128 to 127 SDL for DC have give us a smaller range - INT32 raxis = axis*8; -#else // -32768 to 32767 + // -32768 to 32767 INT32 raxis = axis/32; -#endif if (which == ev_joystick) { if (Joystick.bGamepadStyle) @@ -1008,8 +762,304 @@ static INT32 SDLJoyAxis(const Sint16 axis, evtype_t which) return raxis; } +static void Impl_HandleWindowEvent(SDL_WindowEvent evt) +{ + static SDL_bool firsttimeonmouse = SDL_TRUE; + static SDL_bool mousefocus = SDL_TRUE; + static SDL_bool kbfocus = SDL_TRUE; + + switch (evt.event) + { + case SDL_WINDOWEVENT_ENTER: + mousefocus = SDL_TRUE; + break; + case SDL_WINDOWEVENT_LEAVE: + mousefocus = SDL_FALSE; + break; + case SDL_WINDOWEVENT_FOCUS_GAINED: + kbfocus = SDL_TRUE; + mousefocus = SDL_TRUE; + break; + case SDL_WINDOWEVENT_FOCUS_LOST: + kbfocus = SDL_FALSE; + mousefocus = SDL_FALSE; + break; + case SDL_WINDOWEVENT_MAXIMIZED: + break; + } + + if (mousefocus && kbfocus) + { + if (!firsttimeonmouse) + { + if (cv_usemouse.value) I_StartupMouse(); + } + //else firsttimeonmouse = SDL_FALSE; + if (gamestate == GS_LEVEL) + { + if (!paused) I_ResumeSong(0); //resume it + } + } + else if (!mousefocus && !kbfocus) + { + if (!disable_mouse) + { + SDLforceUngrabMouse(); + } + if (!netgame && gamestate == GS_LEVEL && !demoplayback && !demorecording && !modeattacking) + { + paused = true; + } + memset(gamekeydown, 0, NUMKEYS); // TODO this is a scary memset + if (gamestate == GS_LEVEL) + { + I_PauseSong(0); + } + + if (MOUSE_MENU) + { + SDLdoUngrabMouse(); + } + } + +} + +static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type) +{ + event_t event; + if (type == SDL_KEYUP) + { + event.type = ev_keyup; + } + else if (type == SDL_KEYDOWN) + { + event.type = ev_keydown; + } + else + { + return; + } + event.data1 = SDLatekey(evt.keysym.sym); + if (event.data1) D_PostEvent(&event); +} + +static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt) +{ + event_t event; + int wwidth, wheight; + + SDL_GetWindowSize(window, &wwidth, &wheight); + + if ((SDL_GetMouseFocus() != window && SDL_GetKeyboardFocus() != window)) + { + SDLdoUngrabMouse(); + return; + } + + if ((evt.x == realwidth/2) && (evt.y == realheight/2)) + { + return; + } + else + { + event.data2 = (evt.xrel) * (wwidth / realwidth); + event.data3 = -evt.yrel * (wheight / realheight); + } + + event.type = ev_mouse; + + if (SDL_GetMouseFocus() == window && SDL_GetKeyboardFocus() == window) + { + D_PostEvent(&event); + HalfWarpMouse(wwidth, wheight); + } +} + +static void Impl_HandleMouseButtonEvent(SDL_MouseButtonEvent evt, Uint32 type) +{ + event_t event; + + SDL_memset(&event, 0, sizeof(event_t)); + + /// \todo inputEvent.button.which + if (USE_MOUSEINPUT) + { + if (type == SDL_MOUSEBUTTONUP) + { + event.type = ev_keyup; + } + else if (type == SDL_MOUSEBUTTONDOWN) + { + event.type = ev_keydown; + } + else return; + if (evt.button == SDL_BUTTON_MIDDLE) + event.data1 = KEY_MOUSE1+2; + else if (evt.button == SDL_BUTTON_RIGHT) + event.data1 = KEY_MOUSE1+1; + else if (evt.button == SDL_BUTTON_LEFT) + event.data1= KEY_MOUSE1; + else if (evt.button <= MOUSEBUTTONS) + event.data1 = KEY_MOUSE1 + evt.which - SDL_BUTTON_LEFT; + if (event.type == ev_keyup || event.type == ev_keydown) + { + D_PostEvent(&event); + } + } +} + +static void Impl_HandleMouseWheelEvent(SDL_MouseWheelEvent evt) +{ + event_t event; + + SDL_memset(&event, 0, sizeof(event_t)); + + if (evt.y > 0) + { + event.data1 = KEY_MOUSEWHEELUP; + event.type = ev_keydown; + } + if (evt.y < 0) + { + event.data1 = KEY_MOUSEWHEELDOWN; + event.type = ev_keydown; + } + if (evt.y == 0) + { + event.data1 = 0; + event.type = ev_keyup; + } + if (event.type == ev_keyup || event.type == ev_keydown) + { + D_PostEvent(&event); + } +} + +static void Impl_HandleJoystickAxisEvent(SDL_JoyAxisEvent evt) +{ + event_t event; + SDL_JoystickID joyid[2]; + + // Determine the Joystick IDs for each current open joystick + joyid[0] = SDL_JoystickInstanceID(JoyInfo.dev); + joyid[1] = SDL_JoystickInstanceID(JoyInfo.dev); + + evt.axis++; + event.data1 = event.data2 = event.data3 = INT32_MAX; + + if (evt.which == joyid[0]) + { + event.type = ev_joystick; + } + else if (evt.which == joyid[1]) + { + event.type = ev_joystick2; + } + else return; + //axis + if (evt.axis > JOYAXISSET*2) + return; + //vaule + if (evt.axis%2) + { + event.data1 = evt.axis / 2; + event.data2 = SDLJoyAxis(evt.value, event.type); + } + else + { + evt.axis--; + event.data1 = evt.axis / 2; + event.data3 = SDLJoyAxis(evt.value, event.type); + } + D_PostEvent(&event); +} + +static void Impl_HandleJoystickButtonEvent(SDL_JoyButtonEvent evt, Uint32 type) +{ + event_t event; + SDL_JoystickID joyid[2]; + + // Determine the Joystick IDs for each current open joystick + joyid[0] = SDL_JoystickInstanceID(JoyInfo.dev); + joyid[1] = SDL_JoystickInstanceID(JoyInfo.dev); + + if (evt.which == joyid[0]) + { + event.data1 = KEY_JOY1; + } + else if (evt.which == joyid[1]) + { + event.data1 = KEY_2JOY1; + } + else return; + if (type == SDL_JOYBUTTONUP) + { + event.type = ev_keyup; + } + else if (type == SDL_JOYBUTTONDOWN) + { + event.type = ev_keydown; + } + else return; + if (evt.button < JOYBUTTONS) + { + event.data1 += evt.button; + } + else return; + + SDLJoyRemap(&event); + if (event.type != ev_console) D_PostEvent(&event); +} + void I_GetEvent(void) { + SDL_Event evt; + + if (!graphics_started) + { + return; + } + + while (SDL_PollEvent(&evt)) + { + switch (evt.type) + { + case SDL_WINDOWEVENT: + Impl_HandleWindowEvent(evt.window); + break; + case SDL_KEYUP: + case SDL_KEYDOWN: + Impl_HandleKeyboardEvent(evt.key, evt.type); + break; + case SDL_MOUSEMOTION: + Impl_HandleMouseMotionEvent(evt.motion); + break; + case SDL_MOUSEBUTTONUP: + case SDL_MOUSEBUTTONDOWN: + Impl_HandleMouseButtonEvent(evt.button, evt.type); + break; + case SDL_MOUSEWHEEL: + Impl_HandleMouseWheelEvent(evt.wheel); + break; + case SDL_JOYAXISMOTION: + Impl_HandleJoystickAxisEvent(evt.jaxis); + break; + case SDL_JOYBUTTONUP: + case SDL_JOYBUTTONDOWN: + Impl_HandleJoystickButtonEvent(evt.jbutton, evt.type); + break; + case SDL_QUIT: + I_Quit(); + M_QuitResponse('y'); + break; + } + } + + // In order to make wheels act like buttons, we have to set their state to Up. + // This is because wheel messages don't have an up/down state. + gamekeydown[KEY_MOUSEWHEELDOWN] = gamekeydown[KEY_MOUSEWHEELUP] = 0; + +#if 0 SDL_Event inputEvent; static SDL_bool sdlquit = SDL_FALSE; //Alam: once, just once event_t event; @@ -1076,7 +1126,7 @@ void I_GetEvent(void) SDLdoUngrabMouse(); break; } - if (USE_MOUSEINPUT) + //if (USE_MOUSEINPUT) TODO SDL2 stub { // If the event is from warping the pointer back to middle // of the screen then ignore it. @@ -1183,7 +1233,6 @@ void I_GetEvent(void) SDLJoyRemap(&event); if (event.type != ev_console) D_PostEvent(&event); break; -#ifndef _WIN32_WCE case SDL_QUIT: if (!sdlquit) { @@ -1191,8 +1240,7 @@ void I_GetEvent(void) M_QuitResponse('y'); } break; -#endif -#if defined(RPC_NO_WINDOWS_H) && !defined(_WIN32_WCE) +#if defined(RPC_NO_WINDOWS_H) case SDL_SYSWMEVENT: MainWndproc(inputEvent.syswm.msg->hwnd, inputEvent.syswm.msg->msg, @@ -1205,15 +1253,8 @@ void I_GetEvent(void) setmodeneeded = VID_GetModeForSize(inputEvent.resize.w,inputEvent.resize.h)+1; if (render_soft == rendermode) { -#ifdef FILTERS - INT32 filtervalue = cv_filter.value; - if (blitfilter) CV_SetValue(&cv_filter,1); -#endif SDLSetMode(realwidth, realheight, vid.bpp*8, surfaceFlagsW); if (vidSurface) SDL_SetColors(vidSurface, localPalette, 0, 256); -#ifdef FILTERS - CV_SetValue(&cv_filter,filtervalue); -#endif } else SDLSetMode(realwidth, realheight, vid.bpp*8, surfaceFlagsW); @@ -1228,7 +1269,7 @@ void I_GetEvent(void) } } //reset wheel like in win32, I don't understand it but works - gamekeydown[KEY_MOUSEWHEELDOWN] = gamekeydown[KEY_MOUSEWHEELUP] = 0; +#endif } void I_StartupMouse(void) @@ -1261,9 +1302,6 @@ void I_OsPolling(void) I_GetJoystickEvents(); I_GetJoystick2Events(); } -#ifdef _arch_dreamcast - //vmu_set_icon(VMU_bits); -#endif I_GetMouseEvents(); @@ -1275,17 +1313,23 @@ void I_OsPolling(void) // void I_UpdateNoBlit(void) { - if (!vidSurface) + if (rendermode == render_none) return; + if (exposevideo) + { #ifdef HWRENDER - if (rendermode != render_soft) - OglSdlFinishUpdate(cv_vidwait.value); - else + if (rendermode == render_opengl) + { + OglSdlFinishUpdate(cv_vidwait.value); + } + else #endif - if (vidSurface->flags&SDL_DOUBLEBUF) - SDL_Flip(vidSurface); - else if (exposevideo) - SDL_UpdateRect(vidSurface, 0, 0, 0, 0); + if (rendermode == render_soft) + { + SDL_RenderCopy(renderer, texture, NULL, NULL); + SDL_RenderPresent(renderer); + } + } exposevideo = SDL_FALSE; } @@ -1302,10 +1346,6 @@ static inline boolean I_SkipFrame(void) skip = !skip; -#if 0 //(defined (GP2X) || defined (PSP) || defined (_arch_dreamcast)) - return skip; -#endif - switch (gamestate) { case GS_LEVEL: @@ -1335,7 +1375,7 @@ static inline SDL_bool SDLmatchVideoformat(void) // void I_FinishUpdate(void) { - if (!vidSurface) + if (rendermode == render_none) return; //Alam: No software or OpenGl surface if (I_SkipFrame()) @@ -1346,152 +1386,30 @@ void I_FinishUpdate(void) if (render_soft == rendermode && screens[0]) { - SDL_Rect *dstrect = NULL; - SDL_Rect rect = {0, 0, 0, 0}; - SDL_PixelFormat *vidformat = vidSurface->format; - int lockedsf = 0, blited = 0; + SDL_Rect rect; - rect.w = (Sint16)vid.width; - rect.h = (Sint16)vid.height; + rect.x = 0; + rect.y = 0; + rect.w = vid.width; + rect.h = vid.height; - if (vidSurface->h > vid.height) - rect.y = (Sint16)((vidSurface->h-vid.height)/2); - - dstrect = ▭ - - - if (!bufSurface && !vid.direct) //Double-Check + if (!bufSurface) //Double-Check { - if (vid.bpp == 1) bufSurface = SDL_CreateRGBSurfaceFrom(screens[0],vid.width,vid.height,8, - (int)vid.rowbytes,0x00000000,0x00000000,0x00000000,0x00000000); // 256 mode - else if (vid.bpp == 2) bufSurface = SDL_CreateRGBSurfaceFrom(screens[0],vid.width,vid.height,15, - (int)vid.rowbytes,0x00007C00,0x000003E0,0x0000001F,0x00000000); // 555 mode - if (bufSurface) SDL_SetColors(bufSurface, localPalette, 0, 256); - else I_OutputMsg("No system memory for SDL buffer surface\n"); + Impl_VideoSetupSDLBuffer(); } - -#ifdef FILTERS - FilterBlit(bufSurface); - if (f2xSurface) //Alam: filter! + if (bufSurface) { - //I_OutputMsg("2x Filter Code\n"); - blited = SDL_BlitSurface(f2xSurface,NULL,vidSurface,NULL); + SDL_BlitSurface(bufSurface, NULL, vidSurface, &rect); + // Fury -- there's no way around UpdateTexture, the GL backend uses it anyway + SDL_LockSurface(vidSurface); + SDL_UpdateTexture(texture, &rect, vidSurface->pixels, vidSurface->pitch); + SDL_UnlockSurface(vidSurface); } - else -#endif -#if 0 - if (SDLmatchVideoformat() && !vid.direct)//Alam: DOS Way - { - if (SDL_MUSTLOCK(vidSurface)) lockedsf = SDL_LockSurface(vidSurface); - if (lockedsf == 0) - { - if (vidSurface->pixels > vid.height) - { - UINT8 *ptr = vidSurface->pixels; - size_t half_excess = vidSurface->pitch*(vidSurface->height-vid.height)/2; - memset(ptr, 0x1F, half_excess); - ptr += half_excess; - VID_BlitLinearScreen(screens[0], ptr, vid.width*vid.bpp, vid.height, - vid.rowbytes, vidSurface->pitch); - ptr += vid.height*vidSurface->pitch; - memset(ptr, 0x1F, half_excess); - } - else - VID_BlitLinearScreen(screens[0], vidSurface->pixels, vid.width*vid.bpp, - vid.height, vid.rowbytes, vidSurface->pitch ); - if (SDL_MUSTLOCK(vidSurface)) SDL_UnlockSurface(vidSurface); - } - } - else -#endif - if (bufSurface) //Alam: New Way to send video data - { - blited = SDL_BlitSurface(bufSurface,NULL,vidSurface,dstrect); - } - else if (vid.bpp == 1 && !vid.direct) - { - Uint8 *bP,*vP; //Src, Dst - Uint16 bW, vW; // Pitch Remainder - Sint32 pH, pW; //Height, Width - bP = (Uint8 *)screens[0]; - bW = (Uint16)(vid.rowbytes - vid.width); - //I_OutputMsg("Old Copy Code\n"); - if (SDL_MUSTLOCK(vidSurface)) lockedsf = SDL_LockSurface(vidSurface); - vP = (Uint8 *)vidSurface->pixels; - vW = (Uint16)(vidSurface->pitch - vidSurface->w*vidformat->BytesPerPixel); - if (vidSurface->h > vid.height) - vP += vidSurface->pitch*(vidSurface->h-vid.height)/2; - if (lockedsf == 0 && vidSurface->pixels) - { - if (vidformat->BytesPerPixel == 2) - { - for (pH=0;pH < vidSurface->h;pH++) - { - for (pW=0;pW < vidSurface->w;pW++) - { - *((Uint16 *)(void *)vP) = (Uint16)SDL_MapRGB(vidformat, - localPalette[*bP].r,localPalette[*bP].g,localPalette[*bP].b); - bP++; - vP += 2; - } - bP += bW; - vP += vW; - } - } - else if (vidformat->BytesPerPixel == 3) - { - for (pH=0;pH < vidSurface->h;pH++) - { - for (pW=0;pW < vidSurface->w;pW++) - { - *((Uint32 *)(void *)vP) = SDL_MapRGB(vidformat, - localPalette[*bP].r,localPalette[*bP].g,localPalette[*bP].b); - bP++; - vP += 3; - } - bP += bW; - vP += vW; - } - } - else if (vidformat->BytesPerPixel == 4) - { - for (pH=0;pH < vidSurface->h;pH++) - { - for (pW=0;pW < vidSurface->w;pW++) - { - *((Uint32 *)(void *)vP) = SDL_MapRGB(vidformat, - localPalette[*bP].r,localPalette[*bP].g,localPalette[*bP].b); - bP++; - vP += 4; - } - bP += bW; - vP += vW; - } - } - else - { - ;//NOP - } - } - if (SDL_MUSTLOCK(vidSurface)) SDL_UnlockSurface(vidSurface); - } - else /// \todo 15t15,15tN, others? - { - ;//NOP - } - -#ifdef HAVE_GP2XSDL - //if (blited == 0) - SDL_GP2X_WaitForBlitter(); -#endif - - if (lockedsf == 0 && blited == 0 && vidSurface->flags&SDL_DOUBLEBUF) - SDL_Flip(vidSurface); - else if (blited != -2 && lockedsf == 0) //Alam: -2 for Win32 Direct, yea, i know - SDL_UpdateRect(vidSurface, rect.x, rect.y, 0, 0); //Alam: almost always - else - I_OutputMsg("%s\n",SDL_GetError()); + SDL_RenderClear(renderer); + SDL_RenderCopy(renderer, texture, NULL, NULL); + SDL_RenderPresent(renderer); } + #ifdef HWRENDER else { @@ -1537,8 +1455,9 @@ void I_SetPalette(RGBA_t *palette) localPalette[i].g = palette[i].s.green; localPalette[i].b = palette[i].s.blue; } - if (vidSurface) SDL_SetColors(vidSurface, localPalette, 0, 256); - if (bufSurface) SDL_SetColors(bufSurface, localPalette, 0, 256); + //if (vidSurface) SDL_SetPaletteColors(vidSurface->format->palette, localPalette, 0, 256); + // Fury -- SDL2 vidSurface is a 32-bit surface buffer copied to the texture. It's not palletized, like bufSurface. + if (bufSurface) SDL_SetPaletteColors(bufSurface->format->palette, localPalette, 0, 256); } // return number of fullscreen + X11 modes @@ -1552,6 +1471,7 @@ INT32 VID_NumModes(void) const char *VID_GetModeName(INT32 modeNum) { +#if 0 if (USE_FULLSCREEN && numVidModes != -1) // fullscreen modes { modeNum += firstEntry; @@ -1564,18 +1484,33 @@ const char *VID_GetModeName(INT32 modeNum) } else // windowed modes { +#endif + if (modeNum == -1) + { + return fallback_resolution_name; + } if (modeNum > MAXWINMODES) return NULL; sprintf(&vidModeName[modeNum][0], "%dx%d", windowedModes[modeNum][0], windowedModes[modeNum][1]); - } + //} return &vidModeName[modeNum][0]; } INT32 VID_GetModeForSize(INT32 w, INT32 h) { + int i; + for (i = 0; i < MAXWINMODES; i++) + { + if (windowedModes[i][0] == w && windowedModes[i][1] == h) + { + return i; + } + } + return -1; +#if 0 INT32 matchMode = -1, i; VID_PrepareModeList(); if (USE_FULLSCREEN && numVidModes != -1) @@ -1636,10 +1571,14 @@ INT32 VID_GetModeForSize(INT32 w, INT32 h) } } return matchMode; +#endif } void VID_PrepareModeList(void) { + // Under SDL2, we just use the windowed modes list, and scale in windowed fullscreen. + allow_fullscreen = true; +#if 0 INT32 i; firstEntry = 0; @@ -1667,42 +1606,18 @@ void VID_PrepareModeList(void) } } allow_fullscreen = true; +#endif } static inline void SDLESSet(void) { -#ifdef HAVE_DCSDL - INT32 j; - SDL_DC_SetVideoDriver(SDL_DC_DIRECT_VIDEO); //SDL_DC_DMA_VIDEO - for (j=0;j<4;j++) - { - SDL_DC_MapKey(j,SDL_DC_START,SDLK_ESCAPE); - SDL_DC_MapKey(j,SDL_DC_A,SDLK_UNKNOWN); - SDL_DC_MapKey(j,SDL_DC_B,SDLK_UNKNOWN); - SDL_DC_MapKey(j,SDL_DC_X,SDLK_UNKNOWN); - SDL_DC_MapKey(j,SDL_DC_Y,SDLK_UNKNOWN); - SDL_DC_MapKey(j,SDL_DC_L,SDLK_UNKNOWN); - SDL_DC_MapKey(j,SDL_DC_R,SDLK_UNKNOWN); - //SDL_DC_MapKey(j,SDL_DC_LEFT,SDLK_UNKNOWN); - //SDL_DC_MapKey(j,SDL_DC_RIGHT,SDLK_UNKNOWN); - //SDL_DC_MapKey(j,SDL_DC_UP,SDLK_UNKNOWN); - //SDL_DC_MapKey(j,SDL_DC_DOWN,SDLK_UNKNOWN); - } - //SDL_DC_MapKey(0,SDL_DC_L,SDLK_LEFTBRACKET); - //SDL_DC_MapKey(0,SDL_DC_R,SDLK_RIGHTBRACKET); - //SDL_DC_MapKey(0,SDL_DC_START,SDLK_UNKNOWN); - //SDL_DC_MapKey(1,SDL_DC_L,SDLK_z); - //SDL_DC_MapKey(1,SDL_DC_R,SDLK_x); -#endif -#ifdef HAVE_GP2XSDL - SDL_GP2X_MiniDisplay(0,0); - //SDL_GP2X_DenyGfxMemory(NULL, 0); - SDL_GP2X_AllowGfxMemory(NULL, 0); -#endif + SDL2STUB(); } static void SDLWMSet(void) { + SDL2STUB(); +#if 0 #ifdef RPC_NO_WINDOWS_H SDL_SysWMinfo SDLWM; memset(&SDLWM,0,sizeof (SDL_SysWMinfo)); @@ -1716,142 +1631,195 @@ static void SDLWMSet(void) SetFocus(vid.WndParent); ShowWindow(vid.WndParent, SW_SHOW); } -#ifndef _WIN32_WCE SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE); -#endif #endif SDL_EventState(SDL_VIDEORESIZE, SDL_IGNORE); +#endif } +#if 0 static void* SDLGetDirect(void) { -#if 0 //#ifndef __MACH__ // Do not directly access the MacOSX's OpenGL memory - if (!SDL_MUSTLOCK(vidSurface) && SDLmatchVideoformat()) - { - vid.rowbytes = vidSurface->pitch; - return vidSurface->pixels; - } -#endif // you can not use the video memory in pixels member in fullscreen mode + // you can not use the video memory in pixels member in fullscreen mode return NULL; } +#endif INT32 VID_SetMode(INT32 modeNum) { -#ifdef _WIN32_WCE - (void)modeNum; -#else SDLdoUngrabMouse(); - vid.recalc = true; - BitsPerPixel = (Uint8)cv_scr_depth.value; - //vid.bpp = BitsPerPixel==8?1:2; - // Window title - SDL_WM_SetCaption("SRB2 "VERSIONSTRING, "SRB2"); - if (render_soft == rendermode) - { - //Alam: SDL_Video system free vidSurface for me - if (vid.buffer) free(vid.buffer); - vid.buffer = NULL; - if (bufSurface) SDL_FreeSurface(bufSurface); - bufSurface = NULL; - } + vid.recalc = 1; + vid.bpp = 1; - if (USE_FULLSCREEN) - { - if (numVidModes != -1) - { - modeNum += firstEntry; - vid.width = modeList[modeNum]->w; - vid.height = modeList[modeNum]->h; - } - else - { - vid.width = windowedModes[modeNum][0]; - vid.height = windowedModes[modeNum][1]; - } - if (render_soft == rendermode) - { - SDLSetMode(vid.width, vid.height, BitsPerPixel, surfaceFlagsF); - - if (!vidSurface) - { - cv_fullscreen.value = 0; - modeNum = VID_GetModeForSize(vid.width,vid.height); - vid.width = windowedModes[modeNum][0]; - vid.height = windowedModes[modeNum][1]; - SDLSetMode(vid.width, vid.height, BitsPerPixel, surfaceFlagsW); - if (!vidSurface) - I_Error("Could not set vidmode: %s\n",SDL_GetError()); - } - } -#ifdef HWRENDER - else // (render_soft != rendermode) - { - if (!OglSdlSurface(vid.width, vid.height, true)) - { - cv_fullscreen.value = 0; - modeNum = VID_GetModeForSize(vid.width,vid.height); - vid.width = windowedModes[modeNum][0]; - vid.height = windowedModes[modeNum][1]; - if (!OglSdlSurface(vid.width, vid.height,false)) - I_Error("Could not set vidmode: %s\n",SDL_GetError()); - } - - realwidth = (Uint16)vid.width; - realheight = (Uint16)vid.height; - } -#endif - } - else //(cv_fullscreen.value) + if (modeNum >= 0 && modeNum < MAXWINMODES-1) { vid.width = windowedModes[modeNum][0]; vid.height = windowedModes[modeNum][1]; - - if (render_soft == rendermode) - { - SDLSetMode(vid.width, vid.height, BitsPerPixel, surfaceFlagsW); - if (!vidSurface) - I_Error("Could not set vidmode: %s\n",SDL_GetError()); - } -#ifdef HWRENDER - else //(render_soft != rendermode) - { - if (!OglSdlSurface(vid.width, vid.height, false)) - I_Error("Could not set vidmode: %s\n",SDL_GetError()); - realwidth = (Uint16)vid.width; - realheight = (Uint16)vid.height; - } -#endif + vid.modenum = modeNum; } + else + { + // just set the desktop resolution as a fallback + SDL_DisplayMode mode; + SDL_GetWindowDisplayMode(window, &mode); + if (mode.w >= 2048) + { + vid.width = 1920; + vid.height = 1200; + } + else + { + vid.width = mode.w; + vid.height = mode.h; + } + vid.modenum = -1; + } + Impl_SetWindowName("SRB2 "VERSIONSTRING); - vid.modenum = VID_GetModeForSize(vidSurface->w,vidSurface->h); + SDLSetMode(windowedModes[modeNum][0], windowedModes[modeNum][1], USE_FULLSCREEN); if (render_soft == rendermode) { - vid.rowbytes = vid.width*vid.bpp; - vid.direct = SDLGetDirect(); - vid.buffer = malloc(vid.rowbytes*vid.height*NUMSCREENS); - if (vid.buffer) memset(vid.buffer,0x00,vid.rowbytes*vid.height*NUMSCREENS); - else I_Error ("Not enough memory for video buffer\n"); + if (bufSurface) + { + SDL_FreeSurface(bufSurface); + bufSurface = NULL; + } + + Impl_VideoSetupBuffer(); } -#if 0 // broken - if (!cv_stretch.value && (float)vid.width/vid.height != ((float)BASEVIDWIDTH/BASEVIDHEIGHT)) - vid.height = (INT32)(vid.width * ((float)BASEVIDHEIGHT/BASEVIDWIDTH));// Adjust the height to match -#endif -#endif - I_StartupMouse(); + return SDL_TRUE; +} - SDLWMSet(); +static SDL_bool Impl_CreateWindow(SDL_bool fullscreen) +{ + int flags = 0; + if (window != NULL) + { + return SDL_FALSE; + } - return true; + if (fullscreen) + { + flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; + } + + if (borderlesswindow) + { + flags |= SDL_WINDOW_BORDERLESS; + } + +#ifdef HWRENDER + if (rendermode == render_opengl) + { + window = SDL_CreateWindow("SRB2", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, + realwidth, realheight, flags | SDL_WINDOW_OPENGL); + if (window != NULL) + { + sdlglcontext = SDL_GL_CreateContext(window); + if (sdlglcontext == NULL) + { + SDL_DestroyWindow(window); + I_Error("Failed to create a GL context: %s\n", SDL_GetError()); + } + else + { + SDL_GL_MakeCurrent(window, sdlglcontext); + } + } + else return SDL_FALSE; + } +#endif + if (rendermode == render_soft) + { + window = SDL_CreateWindow("SRB2", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, + realwidth, realheight, flags); + if (window != NULL) + { + renderer = SDL_CreateRenderer(window, -1, (usesdl2soft ? SDL_RENDERER_SOFTWARE : 0) | (cv_vidwait.value && !usesdl2soft ? SDL_RENDERER_PRESENTVSYNC : 0)); + if (renderer != NULL) + { + SDL_RenderSetLogicalSize(renderer, BASEVIDWIDTH, BASEVIDHEIGHT); + } + else return SDL_FALSE; + } + else return SDL_FALSE; + } + + return SDL_TRUE; +} + +static void Impl_SetWindowName(const char *title) +{ + if (window != NULL) + { + return; + } + SDL2STUB(); + SDL_SetWindowTitle(window, title); +} + +static void Impl_SetWindowIcon(void) +{ + if (window == NULL || icoSurface == NULL) + { + return; + } + SDL2STUB(); + SDL_SetWindowIcon(window, icoSurface); +} + +static void Impl_VideoSetupSDLBuffer(void) +{ + if (bufSurface != NULL) + { + SDL_FreeSurface(bufSurface); + bufSurface = NULL; + } + // Set up the SDL palletized buffer (copied to vidbuffer before being rendered to texture) + if (vid.bpp == 1) + { + bufSurface = SDL_CreateRGBSurfaceFrom(screens[0],vid.width,vid.height,8, + (int)vid.rowbytes,0x00000000,0x00000000,0x00000000,0x00000000); // 256 mode + } + else if (vid.bpp == 2) // Fury -- don't think this is used at all anymore + { + bufSurface = SDL_CreateRGBSurfaceFrom(screens[0],vid.width,vid.height,15, + (int)vid.rowbytes,0x00007C00,0x000003E0,0x0000001F,0x00000000); // 555 mode + } + if (bufSurface) + { + SDL_SetPaletteColors(bufSurface->format->palette, localPalette, 0, 256); + } + else + { + I_Error("%s", M_GetText("No system memory for SDL buffer surface\n")); + } +} + +static void Impl_VideoSetupBuffer(void) +{ + // Set up game's software render buffer + if (rendermode == render_soft) + { + vid.rowbytes = vid.width * vid.bpp; + vid.direct = NULL; + vid.buffer = malloc(vid.rowbytes*vid.height*NUMSCREENS); + if (vid.buffer) + { + memset(vid.buffer,0x00,vid.rowbytes*vid.height*NUMSCREENS); + } + else + { + I_Error("%s", M_GetText("Not enough memory for video buffer\n")); + } + } } void I_StartupGraphics(void) { - static char SDLNOMOUSE[] = "SDL_NOMOUSE=1"; - static char SDLVIDEOMID[] = "SDL_VIDEO_CENTERED=center"; - if (dedicated) { rendermode = render_none; @@ -1866,24 +1834,10 @@ void I_StartupGraphics(void) COM_AddCommand ("vid_mode", VID_Command_Mode_f); CV_RegisterVar (&cv_vidwait); CV_RegisterVar (&cv_stretch); -#ifdef FILTERS - CV_RegisterVar (&cv_filter); -#endif -#ifdef _PSP // pitch is 0, mod of 0 crash - disable_mouse = true; -#else disable_mouse = M_CheckParm("-nomouse"); -#endif - if (disable_mouse) - I_PutEnv(SDLNOMOUSE); - if (!I_GetEnv("SDL_VIDEO_CENTERED")) - I_PutEnv(SDLVIDEOMID); - disable_fullscreen = M_CheckParm("-win"); + disable_fullscreen = M_CheckParm("-win") ? 1 : 0; keyboard_started = true; -#ifdef _arch_dreamcast - conio_shutdown(); -#endif #if !defined(HAVE_TTF) #ifdef _WIN32 // Initialize Audio as well, otherwise Win32's DirectX can not use audio @@ -1902,52 +1856,24 @@ void I_StartupGraphics(void) return; } } -#ifdef REMOTE_DEBUGGING -#ifdef _WII - _break(); // break for debugger -#endif -#endif #endif { char vd[100]; //stack space for video name - CONS_Printf(M_GetText("Starting up with video driver : %s\n"), SDL_VideoDriverName(vd,100)); + //CONS_Printf(M_GetText("Starting up with video driver : %s\n"), SDL_VideoDriverName(vd,100)); if (strncasecmp(vd, "gcvideo", 8) == 0 || strncasecmp(vd, "fbcon", 6) == 0 || strncasecmp(vd, "wii", 4) == 0 || strncasecmp(vd, "psl1ght", 8) == 0) framebuffer = SDL_TRUE; } if (M_CheckParm("-software")) + { rendermode = render_soft; - SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY>>1,SDL_DEFAULT_REPEAT_INTERVAL<<2); + } + + usesdl2soft = M_CheckParm("-softblit"); + borderlesswindow = M_CheckParm("-borderless"); + + //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY>>1,SDL_DEFAULT_REPEAT_INTERVAL<<2); SDLESSet(); VID_Command_ModeList_f(); - vid.buffer = NULL; // For software mode - vid.width = BASEVIDWIDTH; // Default size for startup - vid.height = BASEVIDHEIGHT; // BitsPerPixel is the SDL interface's - vid.recalc = true; // Set up the console stufff - vid.direct = NULL; // Maybe direct access? - vid.bpp = 1; // This is the game engine's Bpp - vid.WndParent = NULL; //For the window? - -#ifdef HAVE_TTF - I_ShutdownTTF(); -#endif - - // Window title -#ifdef _WIN32_WCE - SDL_WM_SetCaption("SRB2 "VERSIONSTRING, "SRB2"); -#else - SDL_WM_SetCaption("SRB2: Starting up", "SRB2"); -#endif - - // Window icon -#ifdef HAVE_IMAGE - icoSurface = IMG_ReadXPMFromArray(SDL_icon_xpm); -#endif - SDL_WM_SetIcon(icoSurface, NULL); - -#ifdef _WIN32 - //DisableAero(); //also disable Aero on Vista -#endif - #ifdef HWRENDER if (M_CheckParm("-opengl") || rendermode == render_opengl) { @@ -1980,68 +1906,49 @@ void I_StartupGraphics(void) // check gl renderer lib if (HWD.pfnGetRenderVersion() != VERSION) I_Error("%s", M_GetText("The version of the renderer doesn't match the version of the executable\nBe sure you have installed SRB2 properly.\n")); -#if 1 //#ifdef _WIN32_WCE - vid.width = BASEVIDWIDTH; - vid.height = BASEVIDHEIGHT; -#else - vid.width = 640; // hack to make voodoo cards work in 640x480 - vid.height = 480; -#endif - if (HWD.pfnInit(I_Error)) // let load the OpenGL library + if (!HWD.pfnInit(I_Error)) // let load the OpenGL library { - /* - * We want at least 1 bit R, G, and B, - * and at least 16 bpp. Why 1 bit? May be more? - */ - SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 1); - SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 1); - SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 1); - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - if (!OglSdlSurface(vid.width, vid.height, (USE_FULLSCREEN))) - if (!OglSdlSurface(vid.width, vid.height, !(USE_FULLSCREEN))) - rendermode = render_soft; - } - else rendermode = render_soft; - } -#else - rendermode = render_soft; //force software mode when there no HWRENDER code -#endif - if (render_soft == rendermode) - { -#if defined(_WII) - vid.width = 640; - vid.height = 480; -#elif defined(_PS3) - vid.width = 720; - vid.height = 480; -#else - vid.width = BASEVIDWIDTH; - vid.height = BASEVIDHEIGHT; -#endif - SDLSetMode(vid.width, vid.height, BitsPerPixel, surfaceFlagsW); - if (!vidSurface) - { - CONS_Printf(M_GetText("Could not set vidmode: %s\n") ,SDL_GetError()); - vid.rowbytes = 0; - graphics_started = true; - return; } - vid.rowbytes = vid.width * vid.bpp; - vid.direct = SDLGetDirect(); - vid.buffer = malloc(vid.rowbytes*vid.height*NUMSCREENS); - if (vid.buffer) memset(vid.buffer,0x00,vid.rowbytes*vid.height*NUMSCREENS); - else CONS_Printf("%s", M_GetText("Not enough memory for video buffer\n")); } +#endif + + // Fury: we do window initialization after GL setup to allow + // SDL_GL_LoadLibrary to work well on Windows + + // Create window + //Impl_CreateWindow(USE_FULLSCREEN); + //Impl_SetWindowName("SRB2"); + VID_SetMode(VID_GetModeForSize(BASEVIDWIDTH, BASEVIDHEIGHT)); + + vid.buffer = NULL; // For software mode + vid.width = BASEVIDWIDTH; // Default size for startup + vid.height = BASEVIDHEIGHT; // BitsPerPixel is the SDL interface's + vid.recalc = true; // Set up the console stufff + vid.direct = NULL; // Maybe direct access? + vid.bpp = 1; // This is the game engine's Bpp + vid.WndParent = NULL; //For the window? + +#ifdef HAVE_TTF + I_ShutdownTTF(); +#endif + // Window icon +#ifdef HAVE_IMAGE + icoSurface = IMG_ReadXPMFromArray(SDL_icon_xpm); +#endif + Impl_SetWindowIcon(); + + VID_SetMode(VID_GetModeForSize(BASEVIDWIDTH, BASEVIDHEIGHT)); + if (M_CheckParm("-nomousegrab")) mousegrabok = SDL_FALSE; -#ifdef _DEBUG +#if 0 // defined (_DEBUG) else { char videodriver[4] = {'S','D','L',0}; if (!M_CheckParm("-mousegrab") && - SDL_VideoDriverName(videodriver,4) && - strncasecmp("X11",videodriver,4) == 0) + *strncpy(videodriver, SDL_GetCurrentVideoDriver(), 4) != '\0' && + strncasecmp("x11",videodriver,4) == 0) mousegrabok = SDL_FALSE; //X11's XGrabPointer not good } #endif @@ -2071,30 +1978,23 @@ void I_ShutdownGraphics(void) vid.buffer = NULL; if (bufSurface) SDL_FreeSurface(bufSurface); bufSurface = NULL; -#ifdef FILTERS - if (preSurface) SDL_FreeSurface(preSurface); - preSurface = NULL; - if (f2xSurface) SDL_FreeSurface(f2xSurface); - f2xSurface = NULL; -#endif } // was graphics initialized anyway? if (!graphics_started) return; CONS_Printf("I_ShutdownGraphics: "); -#ifdef _WIN32 - //ResetAero(); -#endif graphics_started = false; CONS_Printf("%s", M_GetText("shut down\n")); #ifdef HWRENDER if (GLUhandle) hwClose(GLUhandle); + if (sdlglcontext) + { + SDL_GL_DeleteContext(sdlglcontext); + } #endif -#ifndef _arch_dreamcast SDL_QuitSubSystem(SDL_INIT_VIDEO); -#endif framebuffer = SDL_FALSE; } #endif diff --git a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj index 1b1a9fdf6..b2d687e24 100644 --- a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj +++ b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj @@ -1214,7 +1214,7 @@ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.8; + CURRENT_PROJECT_VERSION = 2.1.9; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", NORMALSRB2, @@ -1226,7 +1226,7 @@ C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.8; + CURRENT_PROJECT_VERSION = 2.1.9; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_PREPROCESSOR_DEFINITIONS = ( @@ -1264,7 +1264,7 @@ GCC_PREPROCESSOR_DEFINITIONS = ( MAC_ALERT, SDLMAIN, - SDL, + HAVE_SDL, HAVE_MIXER, HAVE_PNG, HAVE_BLUA, @@ -1386,7 +1386,7 @@ GCC_PREPROCESSOR_DEFINITIONS = ( MAC_ALERT, SDLMAIN, - SDL, + HAVE_SDL, HAVE_MIXER, HAVE_PNG, HAVE_BLUA, diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 98159b473..8c90557f0 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -3,7 +3,7 @@ #include "../doomdef.h" -#if defined(SDL) && defined(HAVE_MIXER) && SOUND==SOUND_MIXER +#if defined(HAVE_SDL) && defined(HAVE_MIXER) && SOUND==SOUND_MIXER #include "../sounds.h" #include "../s_sound.h" @@ -617,7 +617,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping) } #endif - music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len)); + music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len), SDL_FALSE); if (!music) { CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError()); @@ -778,7 +778,7 @@ void I_SetMIDIMusicVolume(UINT8 volume) INT32 I_RegisterSong(void *data, size_t len) { - music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len)); + music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len), SDL_FALSE); if (!music) { CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError()); diff --git a/src/sdl/ogl_sdl.c b/src/sdl/ogl_sdl.c index 9427d3317..62055e104 100644 --- a/src/sdl/ogl_sdl.c +++ b/src/sdl/ogl_sdl.c @@ -21,10 +21,12 @@ #pragma warning(disable : 4214 4244) #endif -#ifdef SDL +#ifdef HAVE_SDL #include "SDL.h" +#include "sdlmain.h" + #ifdef _MSC_VER #pragma warning(default : 4214 4244) #endif @@ -62,19 +64,11 @@ PFNglGetIntegerv pglGetIntegerv; PFNglGetString pglGetString; #endif -#ifdef _PSP -static const Uint32 WOGLFlags = SDL_HWSURFACE|SDL_OPENGL/*|SDL_RESIZABLE*/; -static const Uint32 FOGLFlags = SDL_HWSURFACE|SDL_OPENGL|SDL_FULLSCREEN; -#else -static const Uint32 WOGLFlags = SDL_OPENGL/*|SDL_RESIZABLE*/; -static const Uint32 FOGLFlags = SDL_OPENGL|SDL_FULLSCREEN; -#endif - /** \brief SDL video display surface */ -SDL_Surface *vidSurface = NULL; INT32 oglflags = 0; void *GLUhandle = NULL; +SDL_GLContext sdlglcontext = 0; #ifndef STATIC_OPENGL void *GetGLFunc(const char *proc) @@ -156,36 +150,13 @@ boolean LoadGL(void) \return if true, changed video mode */ -boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen) +boolean OglSdlSurface(INT32 w, INT32 h) { INT32 cbpp; - Uint32 OGLFlags; const GLvoid *glvendor = NULL, *glrenderer = NULL, *glversion = NULL; cbpp = cv_scr_depth.value < 16 ? 16 : cv_scr_depth.value; - if (vidSurface) - { - //Alam: SDL_Video system free vidSurface for me -#ifdef VOODOOSAFESWITCHING - SDL_QuitSubSystem(SDL_INIT_VIDEO); - SDL_InitSubSystem(SDL_INIT_VIDEO); -#endif - } - - if (isFullscreen) - OGLFlags = FOGLFlags; - else - OGLFlags = WOGLFlags; - - cbpp = SDL_VideoModeOK(w, h, cbpp, OGLFlags); - if (cbpp < 16) - return true; //Alam: Let just say we did, ok? - - vidSurface = SDL_SetVideoMode(w, h, cbpp, OGLFlags); - if (!vidSurface) - return false; - glvendor = pglGetString(GL_VENDOR); // Get info and extensions. //BP: why don't we make it earlier ? @@ -200,55 +171,21 @@ boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen) DBG_Printf("Extensions : %s\n", gl_extensions); oglflags = 0; -#ifdef _WIN32 - // BP: disable advenced feature that don't work on somes hardware - // Hurdler: Now works on G400 with bios 1.6 and certified drivers 6.04 - if (strstr(glrenderer, "810")) oglflags |= GLF_NOZBUFREAD; -#elif defined (unix) || defined (UNIXCOMMON) - // disable advanced features not working on somes hardware - if (strstr(glrenderer, "G200")) oglflags |= GLF_NOTEXENV; - if (strstr(glrenderer, "G400")) oglflags |= GLF_NOTEXENV; -#endif - DBG_Printf("oglflags : 0x%X\n", oglflags ); - -#ifdef USE_PALETTED_TEXTURE - if (isExtAvailable("GL_EXT_paletted_texture", gl_extensions)) - glColorTableEXT = SDL_GL_GetProcAddress("glColorTableEXT"); - else - glColorTableEXT = NULL; -#endif - -#ifdef USE_WGL_SWAP - if (isExtAvailable("WGL_EXT_swap_control", gl_extensions)) - wglSwapIntervalEXT = SDL_GL_GetProcAddress("wglSwapIntervalEXT"); - else - wglSwapIntervalEXT = NULL; -#else - if (isExtAvailable("GLX_SGI_swap_control", gl_extensions)) - glXSwapIntervalSGIEXT = SDL_GL_GetProcAddress("glXSwapIntervalSGI"); - else - glXSwapIntervalSGIEXT = NULL; -#endif - -#ifndef KOS_GL_COMPATIBILITY if (isExtAvailable("GL_EXT_texture_filter_anisotropic", gl_extensions)) pglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maximumAnisotropy); else -#endif - maximumAnisotropy = 0; + maximumAnisotropy = 1; granisotropicmode_cons_t[1].value = maximumAnisotropy; + SDL_GL_SetSwapInterval(cv_vidwait.value ? 1 : 0); + SetModelView(w, h); SetStates(); pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); HWR_Startup(); -#ifdef KOS_GL_COMPATIBILITY - textureformatGL = GL_ARGB4444; -#else textureformatGL = cbpp > 16 ? GL_RGBA : GL_RGB5_A1; -#endif return true; } @@ -264,17 +201,11 @@ void OglSdlFinishUpdate(boolean waitvbl) static boolean oldwaitvbl = false; if (oldwaitvbl != waitvbl) { -#ifdef USE_WGL_SWAP - if (wglSwapIntervalEXT) - wglSwapIntervalEXT(waitvbl); -#else - if (glXSwapIntervalSGIEXT) - glXSwapIntervalSGIEXT(waitvbl); -#endif + SDL_GL_SetSwapInterval(waitvbl ? 1 : 0); } oldwaitvbl = waitvbl; - SDL_GL_SwapBuffers(); + SDL_GL_SwapWindow(window); } EXPORT void HWRAPI( OglSdlSetPalette) (RGBA_t *palette, RGBA_t *pgamma) @@ -283,10 +214,6 @@ EXPORT void HWRAPI( OglSdlSetPalette) (RGBA_t *palette, RGBA_t *pgamma) UINT32 redgamma = pgamma->s.red, greengamma = pgamma->s.green, bluegamma = pgamma->s.blue; -#if 0 // changing the gamma to 127 is a bad idea - i = SDL_SetGamma(byteasfloat(redgamma), byteasfloat(greengamma), byteasfloat(bluegamma)); -#endif - if (i == 0) redgamma = greengamma = bluegamma = 0x7F; //Alam: cool for (i = 0; i < 256; i++) { myPaletteData[i].s.red = (UINT8)MIN((palette[i].s.red * redgamma) /127, 255); @@ -294,20 +221,6 @@ EXPORT void HWRAPI( OglSdlSetPalette) (RGBA_t *palette, RGBA_t *pgamma) myPaletteData[i].s.blue = (UINT8)MIN((palette[i].s.blue * bluegamma) /127, 255); myPaletteData[i].s.alpha = palette[i].s.alpha; } -#ifdef USE_PALETTED_TEXTURE - if (glColorTableEXT) - { - for (i = 0; i < 256; i++) - { - palette_tex[(3*i)+0] = palette[i].s.red; - palette_tex[(3*i)+1] = palette[i].s.green; - palette_tex[(3*i)+2] = palette[i].s.blue; - } - glColorTableEXT(GL_TEXTURE_2D, GL_RGB8, 256, GL_RGB, GL_UNSIGNED_BYTE, palette_tex); - } -#endif - // on a chang�de palette, il faut recharger toutes les textures - // jaja, und noch viel mehr ;-) Flush(); } diff --git a/src/sdl/ogl_sdl.h b/src/sdl/ogl_sdl.h index 43c28fa42..72f130a52 100644 --- a/src/sdl/ogl_sdl.h +++ b/src/sdl/ogl_sdl.h @@ -18,13 +18,16 @@ #include "../v_video.h" -extern SDL_Surface *vidSurface; extern void *GLUhandle; -boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen); +boolean OglSdlSurface(INT32 w, INT32 h); void OglSdlFinishUpdate(boolean vidwait); +extern SDL_Window *window; +extern SDL_Renderer *renderer; +extern SDL_GLContext sdlglcontext; + #ifdef _CREATE_DLL_ EXPORT void HWRAPI( OglSdlSetPalette ) (RGBA_t *palette, RGBA_t *pgamma); #endif diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c index 3750e6778..5d6c007b5 100644 --- a/src/sdl/sdl_sound.c +++ b/src/sdl/sdl_sound.c @@ -23,7 +23,7 @@ #pragma warning(disable : 4214 4244) #endif -#if defined(SDL) && SOUND==SOUND_SDL +#if defined(HAVE_SDL) && SOUND==SOUND_SDL #include "SDL.h" @@ -856,6 +856,7 @@ FUNCINLINE static ATTRINLINE void I_UpdateStream16S(Uint8 *stream, int len) if (Snd_Mutex) SDL_LockMutex(Snd_Mutex); + // Mix sounds into the mixing buffer. // Loop over len while (len--) @@ -945,6 +946,7 @@ FUNCINLINE static ATTRINLINE void I_UpdateStream16M(Uint8 *stream, int len) if (Snd_Mutex) SDL_LockMutex(Snd_Mutex); + // Mix sounds into the mixing buffer. // Loop over len while (len--) @@ -1050,10 +1052,7 @@ static void SDLCALL I_UpdateStream(void *userdata, Uint8 *stream, int len) if (!sound_started || !userdata) return; -#if SDL_VERSION_ATLEAST(1,3,0) - if (musicStarted) - memset(stream, 0x00, len); // only work in !AUDIO_U8, that needs 0x80 -#endif + memset(stream, 0x00, len); // only work in !AUDIO_U8, that needs 0x80 if ((audio.channels != 1 && audio.channels != 2) || (audio.format != AUDIO_S8 && audio.format != AUDIO_S16SYS)) @@ -1320,8 +1319,8 @@ void I_StartupSound(void) } else { - char ad[100]; - CONS_Printf(M_GetText(" Starting up with audio driver : %s\n"), SDL_AudioDriverName(ad, (int)sizeof ad)); + //char ad[100]; + //CONS_Printf(M_GetText(" Starting up with audio driver : %s\n"), SDL_AudioDriverName(ad, (int)sizeof ad)); } samplecount = audio.samples; CV_SetValue(&cv_samplerate, audio.freq); @@ -1782,7 +1781,9 @@ static boolean I_StartGMESong(const char *musicname, boolean looping) gme_set_user_data(emu, data); gme_set_user_cleanup(emu, I_CleanupGME); gme_start_track(emu, 0); +#ifdef HAVE_MIXER gme_set_fade(emu, Digfade); +#endif Snd_LockAudio(); localdata.gme_emu = emu; @@ -2027,4 +2028,4 @@ static void SDLCALL I_FinishMusic(void) if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex); } #endif -#endif //SDL +#endif //HAVE_SDL diff --git a/src/sdl/sdlmain.h b/src/sdl/sdlmain.h index 1e497b10d..af4e48f75 100644 --- a/src/sdl/sdlmain.h +++ b/src/sdl/sdlmain.h @@ -22,6 +22,11 @@ extern SDL_bool consolevent; extern SDL_bool framebuffer; +#include "../m_fixed.h" + +// SDL2 stub macro +#define SDL2STUB(name) CONS_Printf("SDL2: stubbed: %s:%d\n", __func__, __LINE__) + /** \brief The JoyInfo_s struct info about joystick diff --git a/src/sdl12/IMG_xpm.c b/src/sdl12/IMG_xpm.c new file mode 100644 index 000000000..e08736d66 --- /dev/null +++ b/src/sdl12/IMG_xpm.c @@ -0,0 +1,506 @@ +/* + SDL_image: An example image loading library for use with SDL + Copyright (C) 1999-2004 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 +*/ + +/* $Id: IMG_xpm.c,v 1.10 2004/01/04 22:04:38 slouken Exp $ */ + +/* + * XPM (X PixMap) image loader: + * + * Supports the XPMv3 format, EXCEPT: + * - hotspot coordinates are ignored + * - only colour ('c') colour symbols are used + * - rgb.txt is not used (for portability), so only RGB colours + * are recognized (#rrggbb etc) - only a few basic colour names are + * handled + * + * The result is an 8bpp indexed surface if possible, otherwise 32bpp. + * The colourkey is correctly set if transparency is used. + * + * Besides the standard API, also provides + * + * SDL_Surface *IMG_ReadXPMFromArray(char **xpm) + * + * that reads the image data from an XPM file included in the C source. + * + * TODO: include rgb.txt here. The full table (from solaris 2.6) only + * requires about 13K in binary form. + */ + +#include +#include +#include +#include + +//#include "SDL_image.h" + + +#ifdef LOAD_XPM + +/* See if an image is contained in a data source */ +#if 0 +int IMG_isXPM(SDL_RWops *src) +{ + char magic[9]; + + return (SDL_RWread(src, magic, sizeof (magic), 1) + && memcmp(magic, "/* XPM */", 9) == 0); +} +#endif + +/* Hash table to look up colors from pixel strings */ +#define STARTING_HASH_SIZE 256 + +struct hash_entry { + char *key; + Uint32 color; + struct hash_entry *next; +}; + +struct color_hash { + struct hash_entry **table; + struct hash_entry *entries; /* array of all entries */ + struct hash_entry *next_free; + size_t size; + int maxnum; +}; + +static int hash_key(const char *key, int cpp, size_t size) +{ + int hash; + + hash = 0; + while ( cpp-- > 0 ) { + hash = hash * 33 + *key++; + } + return (int)(hash & (size - 1)); +} + +static struct color_hash *create_colorhash(int maxnum) +{ + size_t bytes; + int s; + struct color_hash *hash; + + /* we know how many entries we need, so we can allocate + everything here */ + hash = malloc(sizeof *hash); + if (!hash) + return NULL; + + /* use power-of-2 sized hash table for decoding speed */ + for (s = STARTING_HASH_SIZE; s < maxnum; s <<= 1) + ; + hash->size = s; + hash->maxnum = maxnum; + bytes = hash->size * sizeof (struct hash_entry **); + hash->entries = NULL; /* in case malloc fails */ + hash->table = malloc(bytes); + if (!hash->table) + return NULL; + memset(hash->table, 0, bytes); + hash->entries = malloc(maxnum * sizeof (struct hash_entry)); + if (!hash->entries) + { + free(hash->table); + return NULL; + } + hash->next_free = hash->entries; + return hash; +} + +static int add_colorhash(struct color_hash *hash, + char *key, int cpp, Uint32 color) +{ + const int indexkey = hash_key(key, cpp, hash->size); + struct hash_entry *e = hash->next_free++; + e->color = color; + e->key = key; + e->next = hash->table[indexkey]; + hash->table[indexkey] = e; + return 1; +} + +/* fast lookup that works if cpp == 1 */ +#define QUICK_COLORHASH(hash, key) ((hash)->table[*(const Uint8 *)(key)]->color) + +static Uint32 get_colorhash(struct color_hash *hash, const char *key, int cpp) +{ + struct hash_entry *entry = hash->table[hash_key(key, cpp, hash->size)]; + while (entry) { + if (memcmp(key, entry->key, cpp) == 0) + return entry->color; + entry = entry->next; + } + return 0; /* garbage in - garbage out */ +} + +static void free_colorhash(struct color_hash *hash) +{ + if (hash && hash->table) { + free(hash->table); + free(hash->entries); + free(hash); + } +} + +/* portable case-insensitive string comparison */ +static int string_equal(const char *a, const char *b, size_t n) +{ + while (*a && *b && n) { + if (toupper((unsigned char)*a) != toupper((unsigned char)*b)) + return 0; + a++; + b++; + n--; + } + return *a == *b; +} + +#undef ARRAYSIZE +#define ARRAYSIZE(a) (int)(sizeof (a) / sizeof ((a)[0])) + +/* + * convert colour spec to RGB (in 0xrrggbb format). + * return 1 if successful. + */ +static int color_to_rgb(const char *spec, size_t speclen, Uint32 *rgb) +{ + /* poor man's rgb.txt */ + static struct { const char *name; Uint32 rgb; } known[] = { + {"none", 0xffffffff}, + {"black", 0x00000000}, + {"white", 0x00ffffff}, + {"red", 0x00ff0000}, + {"green", 0x0000ff00}, + {"blue", 0x000000ff} + }; + + if (spec[0] == '#') { + char buf[7]; + switch (speclen) { + case 4: + buf[0] = buf[1] = spec[1]; + buf[2] = buf[3] = spec[2]; + buf[4] = buf[5] = spec[3]; + break; + case 7: + memcpy(buf, spec + 1, 6); + break; + case 13: + buf[0] = spec[1]; + buf[1] = spec[2]; + buf[2] = spec[5]; + buf[3] = spec[6]; + buf[4] = spec[9]; + buf[5] = spec[10]; + break; + } + buf[6] = '\0'; + *rgb = (Uint32)strtol(buf, NULL, 16); + return 1; + } else { + int i; + for (i = 0; i < ARRAYSIZE(known); i++) + if (string_equal(known[i].name, spec, speclen)) { + *rgb = known[i].rgb; + return 1; + } + return 0; + } +} + +#ifndef MAX +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#endif + +static char *linebuf; +static int buflen; +static const char *error; + +/* + * Read next line from the source. + * If len > 0, it's assumed to be at least len chars (for efficiency). + * Return NULL and set error upon EOF or parse error. + */ +static const char *get_next_line(const char ***lines, SDL_RWops *src, int len) +{ + char *linebufnew; + if (lines) { + return *(*lines)++; + } else { + char c; + int n; + do { + if (SDL_RWread(src, &c, 1, 1) <= 0) { + error = "Premature end of data"; + return NULL; + } + } while (c != '"'); + if (len) { + len += 4; /* "\",\n\0" */ + if (len > buflen){ + buflen = len; + linebufnew = realloc(linebuf, buflen); + if(!linebufnew) { + free(linebuf); + error = "Out of memory"; + return NULL; + } + linebuf = linebufnew; + } + if (SDL_RWread(src, linebuf, len - 1, 1) <= 0) { + error = "Premature end of data"; + return NULL; + } + n = len - 2; + } else { + n = 0; + do { + if (n >= buflen - 1) { + if (buflen == 0) + buflen = 16; + buflen *= 2; + linebufnew = realloc(linebuf, buflen); + if(!linebufnew) { + free(linebuf); + error = "Out of memory"; + return NULL; + } + linebuf = linebufnew; + } + if (SDL_RWread(src, linebuf + n, 1, 1) <= 0) { + error = "Premature end of data"; + return NULL; + } + } while (linebuf[n++] != '"'); + n--; + } + linebuf[n] = '\0'; + return linebuf; + } +} + +#define SKIPSPACE(p) \ +do { \ + while (isspace((unsigned char)*(p))) \ + ++(p); \ +} while (0) + +#define SKIPNONSPACE(p) \ +do { \ + while (!isspace((unsigned char)*(p)) && *p) \ + ++(p); \ +} while (0) + +/* read XPM from either array or RWops */ +static SDL_Surface *load_xpm(const char **xpm, SDL_RWops *src) +{ + SDL_Surface *image = NULL; + int indexc; + int x, y; + int w, h, ncolors, cpp; + int indexed; + Uint8 *dst; + struct color_hash *colors = NULL; + SDL_Color *im_colors = NULL; + char *keystrings = NULL, *nextkey; + const char *line; + const char ***xpmlines = NULL; + int pixels_len; + + error = NULL; + linebuf = NULL; + buflen = 0; + + if (xpm) + xpmlines = &xpm; + + line = get_next_line(xpmlines, src, 0); + if (!line) + goto done; + /* + * The header string of an XPMv3 image has the format + * + * [ ] + * + * where the hotspot coords are intended for mouse cursors. + * Right now we don't use the hotspots but it should be handled + * one day. + */ + if (sscanf(line, "%d %d %d %d", &w, &h, &ncolors, &cpp) != 4 + || w <= 0 || h <= 0 || ncolors <= 0 || cpp <= 0) { + error = "Invalid format description"; + goto done; + } + + keystrings = malloc(ncolors * cpp); + if (!keystrings) { + error = "Out of memory"; + goto done; + } + nextkey = keystrings; + + /* Create the new surface */ + if (ncolors <= 256) { + indexed = 1; + image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 8, + 0, 0, 0, 0); + im_colors = image->format->palette->colors; + image->format->palette->ncolors = ncolors; + } else { + indexed = 0; + image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32, + 0xff0000, 0x00ff00, 0x0000ff, 0); + } + if (!image) { + /* Hmm, some SDL error (out of memory?) */ + goto done; + } + + /* Read the colors */ + colors = create_colorhash(ncolors); + if (!colors) { + error = "Out of memory"; + goto done; + } + for (indexc = 0; indexc < ncolors; ++indexc ) { + const char *p; + line = get_next_line(xpmlines, src, 0); + if (!line) + goto done; + + p = line + cpp + 1; + + /* parse a colour definition */ + for (;;) { + char nametype; + const char *colname; + Uint32 rgb, pixel; + + SKIPSPACE(p); + if (!*p) { + error = "colour parse error"; + goto done; + } + nametype = *p; + SKIPNONSPACE(p); + SKIPSPACE(p); + colname = p; + SKIPNONSPACE(p); + if (nametype == 's') + continue; /* skip symbolic colour names */ + + if (!color_to_rgb(colname, p - colname, &rgb)) + continue; + + memcpy(nextkey, line, cpp); + if (indexed) { + SDL_Color *c = im_colors + indexc; + c->r = (Uint8)(rgb >> 16); + c->g = (Uint8)(rgb >> 8); + c->b = (Uint8)(rgb); + pixel = indexc; + } else + pixel = rgb; + add_colorhash(colors, nextkey, cpp, pixel); + nextkey += cpp; + if (rgb == 0xffffffff) + SDL_SetColorKey(image, SDL_SRCCOLORKEY, pixel); + break; + } + } + + /* Read the pixels */ + pixels_len = w * cpp; + dst = image->pixels; + for (y = 0; y < h; y++) { + line = get_next_line(xpmlines, src, pixels_len); + if (indexed) { + /* optimization for some common cases */ + if (cpp == 1) + for (x = 0; x < w; x++) + dst[x] = (Uint8)QUICK_COLORHASH(colors, + line + x); + else + for (x = 0; x < w; x++) + dst[x] = (Uint8)get_colorhash(colors, + line + x * cpp, + cpp); + } else { + for (x = 0; x < w; x++) + ((Uint32*)dst)[x] = get_colorhash(colors, + line + x * cpp, + cpp); + } + dst += image->pitch; + } + +done: + if (error) { + SDL_FreeSurface(image); + image = NULL; + SDL_SetError(error); + } + free(keystrings); + free_colorhash(colors); + free(linebuf); + return(image); +} + +/* Load a XPM type image from an RWops datasource */ +#if 0 +SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src) +{ + if ( !src ) { + /* The error message has been set in SDL_RWFromFile */ + return NULL; + } + return load_xpm(NULL, src); +} +#endif + +static inline SDL_Surface *IMG_ReadXPMFromArray(const char **xpm) +{ + return load_xpm(xpm, NULL); +} + +#else /* not LOAD_XPM */ + +/* See if an image is contained in a data source */ +#if 0 +int IMG_isXPM(SDL_RWops *src) +{ + return(0); +} + +/* Load a XPM type image from an SDL datasource */ +SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src) +{ + return(NULL); +} +#endif + +static inline SDL_Surface *IMG_ReadXPMFromArray(const char **xpm) +{ + return NULL; +} +#endif /* not LOAD_XPM */ diff --git a/src/sdl12/MakeCYG.cfg b/src/sdl12/MakeCYG.cfg new file mode 100644 index 000000000..5907579c1 --- /dev/null +++ b/src/sdl12/MakeCYG.cfg @@ -0,0 +1,17 @@ +# +# sdl/makeCYG.cfg for SRB2/Cygwin +# + +# +#Cygwin, for debugging + + NOHW=1 + NOHS=1 + NOASM=1 + + OPTS+=-DLINUX + + i_system_o+=$(OBJDIR)/SRB2.res + + # name of the exefile + EXENAME?=lsdlsrb2.exe diff --git a/src/sdl12/MakeNIX.cfg b/src/sdl12/MakeNIX.cfg new file mode 100644 index 000000000..457f52301 --- /dev/null +++ b/src/sdl12/MakeNIX.cfg @@ -0,0 +1,92 @@ +# +# sdl/makeNIX.cfg for SRB2/?nix +# + +#Valgrind support +ifdef VALGRIND +VALGRIND_PKGCONFIG?=valgrind +VALGRIND_CFLAGS?=$(shell $(PKG_CONFIG) $(VALGRIND_PKGCONFIG) --cflags) +VALGRIND_LDFLAGS?=$(shell $(PKG_CONFIG) $(VALGRIND_PKGCONFIG) --libs) +ZDEBUG=1 +LIBS+=$(VALGRIND_LDFLAGS) +ifdef GCC46 +WFLAGS+=-Wno-error=unused-but-set-variable +WFLAGS+=-Wno-unused-but-set-variable +endif +endif + +# +#here is GNU/Linux and other +# + + OPTS=-DUNIXCOMMON + + #LDFLAGS = -L/usr/local/lib + LIBS=-lm +ifdef LINUX + LIBS+=-lrt +ifdef NOTERMIOS + OPTS+=-DNOTERMIOS +endif +endif + +# +#here is Solaris +# +ifdef SOLARIS + NOIPX=1 + NOASM=1 + OPTS+=-DSOLARIS -DINADDR_NONE=INADDR_ANY -DBSD_COMP + OPTS+=-I/usr/local/include -I/opt/sfw/include + LDFLAGS+=-L/opt/sfw/lib + LIBS+=-lsocket -lnsl +endif + +# +#here is FreeBSD +# +ifdef FREEBSD + OPTS+=-DLINUX -DFREEBSD -I/usr/X11R6/include + SDL_CONFIG?=sdl11-config + LDFLAGS+=-L/usr/X11R6/lib + LIBS+=-lipx -lkvm +endif + +# +#here is GP2x (arm-gp2x-linux) +# +ifdef GP2X + PNG_CONFIG?=$(PREFIX)-libpng12-config +ifdef STATIC #need a better setting name + CFLAGS+=-I$(OPEN2X)/include +ifndef NOMIXER + LIBS+=-lvorbisidec +ifdef MIKMOD + LIBS+=-lmikmod +endif +ifdef SMPEGLIB + LIBS+=-lsmpeg + LD=$(CXX) +endif +endif + NONET=1 +endif +ifndef ARCHNAME +"error" +endif + NONX86=1 + NOHW=1 + NOHS=1 + NOMD5=1 + WFLAGS+=-O0 + OPTS+=-DGP2X -ffast-math -mcpu=arm920t + EXENAME?=SRB2GP2X.gpe +endif + +ifndef NOHW + OPTS+=-I/usr/X11R6/include + LDFLAGS+=-L/usr/X11R6/lib +endif + + # name of the exefile + EXENAME?=lsdlsrb2 diff --git a/src/sdl12/Makefile.cfg b/src/sdl12/Makefile.cfg new file mode 100644 index 000000000..1d404c4c9 --- /dev/null +++ b/src/sdl12/Makefile.cfg @@ -0,0 +1,163 @@ +# +# sdl/makefile.cfg for SRB2/SDL +# + +# +#SDL...., *looks at Alam*, THIS IS A MESS! +# + +ifdef UNIXCOMMON +include sdl/MakeNIX.cfg +endif + +ifdef PANDORA +include sdl/SRB2Pandora/Makefile.cfg +endif #ifdef PANDORA + +ifdef DC +include sdl/SRB2DC/Makefile.cfg +endif #ifdef DC + +ifdef PS3N +include sdl/SRB2PS3/Makefile.cfg +endif #ifdef PS3N + +ifdef PSP +include sdl/SRB2PSP/Makefile.cfg +endif #ifdef PSP + +ifdef XBOX +include sdl/SRB2XBOX/Makefile.cfg +endif #ifdef XBOX + +ifdef WINCE +include sdl/SRB2CE/Makefile.cfg +endif #ifef WINCE + +ifdef CYGWIN32 +include sdl/MakeCYG.cfg +endif #ifdef CYGWIN32 + +ifdef SDL_PKGCONFIG +SDL_CFLAGS?=$(shell $(PKG_CONFIG) $(SDL_PKGCONFIG) --cflags) +SDL_LDFLAGS?=$(shell $(PKG_CONFIG) $(SDL_PKGCONFIG) --libs) +else +ifdef PREFIX + SDL_CONFIG?=$(PREFIX)-sdl-config +else + SDL_CONFIG?=sdl-config +endif + +ifdef STATIC + SDL_CFLAGS?=$(shell $(SDL_CONFIG) --cflags) + SDL_LDFLAGS?=$(shell $(SDL_CONFIG) --static-libs) +else + SDL_CFLAGS?=$(shell $(SDL_CONFIG) --cflags) + SDL_LDFLAGS?=$(shell $(SDL_CONFIG) --libs) +endif +endif + + + #use the x86 asm code +ifndef CYGWIN32 +ifndef NOASM + USEASM=1 +endif +endif + + OBJS+=$(OBJDIR)/i_video.o $(OBJDIR)/dosstr.o $(OBJDIR)/endtxt.o $(OBJDIR)/hwsym_sdl.o + + OPTS+=-DDIRECTFULLSCREEN -DHAVE_SDL + +ifndef NOHW + OBJS+=$(OBJDIR)/r_opengl.o $(OBJDIR)/ogl_sdl.o +endif + +ifndef NOHS +ifdef OPENAL + OBJS+=$(OBJDIR)/s_openal.o + OPTS+=-DSTATIC3DS + STATICHS=1 +else +ifdef FMOD + OBJS+=$(OBJDIR)/s_fmod.o + OPTS+=-DSTATIC3DS + STATICHS=1 +else +ifdef MINGW +ifdef DS3D + OBJS+=$(OBJDIR)/s_ds3d.o + OPTS+=-DSTATIC3DS + STATICHS=1 +endif +endif +endif +endif +endif + +ifdef FILTERS + OBJS+=$(OBJDIR)/filters.o $(OBJDIR)/hq2x.o $(OBJDIR)/lq2x.o + OPTS+=-DHAVE_FILTER +endif + +ifdef NOMIXER + i_sound_o=$(OBJDIR)/sdl_sound.o +else + i_sound_o=$(OBJDIR)/mixer_sound.o + OPTS+=-DHAVE_MIXER + SDL_LDFLAGS+=-lSDL_mixer +endif + +ifdef SDL_TTF + OPTS+=-DHAVE_TTF + SDL_LDFLAGS+=-lSDL_ttf -lfreetype -lz + OBJS+=$(OBJDIR)/i_ttf.o +endif + +#ifdef SDL_IMAGE +# OPTS+=-DHAVE_IMAGE +# SDL_LDFLAGS+=-lSDL_image +#endif + +ifdef SDL_NET + OPTS+=-DHAVE_SDLNET + SDL_LDFLAGS+=-lSDL_net +endif + +ifdef SDLMAIN + OPTS+=-DSDLMAIN +else +ifdef MINGW + SDL_CFLAGS+=-Umain + SDL_LDFLAGS+=-mconsole +endif +endif + +ifndef NOHW +ifdef OPENAL +ifdef MINGW + LIBS:=-lopenal32 $(LIBS) +else + LIBS:=-lopenal $(LIBS) +endif +else +ifdef MINGW +ifdef DS3D + LIBS:=-ldsound -luuid $(LIBS) +endif +endif +endif +endif + +# FIXME: DevkitPPC and ready-compiled SDL Wii require these things to be in a silly order +ifdef WII +include sdl/SRB2WII/Makefile.cfg +endif #ifdef WII + +CFLAGS+=$(SDL_CFLAGS) +LIBS:=$(SDL_LDFLAGS) $(LIBS) +ifndef WII +ifdef STATIC + LIBS+=$(shell $(SDL_CONFIG) --static-libs) +endif +endif diff --git a/src/sdl12/SDL_icon.xpm b/src/sdl12/SDL_icon.xpm new file mode 100644 index 000000000..70bb02d3c --- /dev/null +++ b/src/sdl12/SDL_icon.xpm @@ -0,0 +1,80 @@ +/* XPM */ +static const char * SDL_icon_xpm[] = { +"32 32 45 1", +" c None", +". c #6B6BFF", +"+ c #3D00B9", +"@ c #4848FF", +"# c #2525FF", +"$ c #310096", +"% c #003196", +"& c #003DB9", +"* c #620096", +"= c #6E6E6E", +"- c #966200", +"; c #250073", +"> c #626262", +", c #FF8F6B", +"' c #FFC66B", +") c #FFAB8E", +"! c #000080", +"~ c #B6B6B6", +"{ c #929292", +"] c #FFD48E", +"^ c #0000B9", +"/ c #565656", +"( c #868686", +"_ c #808080", +": c #C0C0C0", +"< c #DADADA", +"[ c #F2F2F2", +"} c #FFFFFF", +"| c #CECECE", +"1 c #AAAAAA", +"2 c #E6E6E6", +"3 c #000096", +"4 c #AB8EFF", +"5 c #190050", +"6 c #000000", +"7 c #8E8EFF", +"8 c #3E3E3E", +"9 c #7A7A7A", +"0 c #0E0E0E", +"a c #9E9E9E", +"b c #001950", +"c c #C2C2C2", +"d c #323232", +"e c #002573", +"f c #A0A0A4", +" ", +" ", +" ", +" .+@##@. ", +" @@.@#######@ ", +" @@....######### ", +" .. .@.....@+##$%%%&&% ", +" ..@# @@....@+#*=-;%%%%% ", +" ..@#@......@>,')!%%%$ ", +" ~..$#.........{])^#+%/ ", +" +##@.........()^@@@@@_ ", +" $####@........#=#######+ ", +" +######....@@##^#########_ ", +" +#####=:<<:+##############/ ", +"[<=####{<}}}}|###############= ", +" }1###=2}}}}}}.############### ", +" }<3#3~}}}}}}}4################ ", +" }<5#6:}}}}}}}7################/", +" }:6861}}}}}}}.########$$ 9 .@$", +" }:0a6~}}}}}}}@######5b ", +"22cd262}}}}}}2######5b$ ", +" 2>1a}}}}}}}{(*###%be## ", +" 860)1<[22c1)]]+##be### ", +" ~)]]]))))]]]]]=#bb#### ", +" )]]]]]]]]](]]=eb$#### ", +" :]]]]]]]]]'9bbb$##### ", +" ),'''''( >db+### ", +" =##f ", +" { ", +" ", +" ", +" "}; diff --git a/src/sdl12/SDL_main/SDL_dummy_main.c b/src/sdl12/SDL_main/SDL_dummy_main.c new file mode 100644 index 000000000..d8cfdd5bb --- /dev/null +++ b/src/sdl12/SDL_main/SDL_dummy_main.c @@ -0,0 +1,12 @@ +/* Include the SDL main definition header */ +#include "SDL_main.h" + +#ifdef main +#undef main +int main(int argc, char *argv[]) +{ + return(SDL_main(argc, argv)); +} +#else +/* Nothing to do on this platform */; +#endif diff --git a/src/sdl12/SDL_main/SDL_macosx_main.h b/src/sdl12/SDL_main/SDL_macosx_main.h new file mode 100644 index 000000000..4683df57a --- /dev/null +++ b/src/sdl12/SDL_main/SDL_macosx_main.h @@ -0,0 +1,11 @@ +/* SDLMain.m - main entry point for our Cocoa-ized SDL app + Initial Version: Darrell Walisser + Non-NIB-Code & other changes: Max Horn + + Feel free to customize this file to suit your needs +*/ + +#import + +@interface SDLMain : NSObject +@end diff --git a/src/sdl12/SDL_main/SDL_macosx_main.m b/src/sdl12/SDL_main/SDL_macosx_main.m new file mode 100644 index 000000000..226afe13d --- /dev/null +++ b/src/sdl12/SDL_main/SDL_macosx_main.m @@ -0,0 +1,374 @@ +/* SDLMain.m - main entry point for our Cocoa-ized SDL app + Initial Version: Darrell Walisser + Non-NIB-Code & other changes: Max Horn + + Feel free to customize this file to suit your needs +*/ + +#import "SDL.h" +#import "SDL_macosx_main.h" +#import /* for MAXPATHLEN */ +#import + +/* For some reaon, Apple removed setAppleMenu from the headers in 10.4, + but the method still is there and works. To avoid warnings, we declare + it ourselves here. */ +@interface NSApplication(SDL_Missing_Methods) +- (void)setAppleMenu:(NSMenu *)menu; +@end + +/* Use this flag to determine whether we use SDLMain.nib or not */ +#define SDL_USE_NIB_FILE 0 + +/* Use this flag to determine whether we use CPS (docking) or not */ +#define SDL_USE_CPS 1 +#if SDL_USE_CPS +/* Portions of CPS.h */ +typedef struct CPSProcessSerNum +{ + UInt32 lo; + UInt32 hi; +} CPSProcessSerNum; + +extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn); +extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); +extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn); + +#endif /* SDL_USE_CPS */ + +static int gArgc; +static char **gArgv; +static BOOL gFinderLaunch; + +static void addArgument(const char *value) +{ + if(!gArgc) + gArgv = (char **)malloc(sizeof(*gArgv)); + else + { + char **newgArgv = (char **)realloc(gArgv, sizeof(*gArgv) * (gArgc + 1)); + if (!newgArgv) + { + newgArgv = malloc(sizeof(*gArgv) * (gArgc + 1)); + memcpy(newgArgv, gArgv, sizeof(*gArgv) * gArgc); + free(gArgv); + } + gArgv = newgArgv; + } + gArgc++; + gArgv[gArgc - 1] = (char *)malloc(sizeof(char) * (strlen(value) + 1)); + strcpy(gArgv[gArgc - 1], value); +} + +static NSString *getApplicationName(void) +{ + NSDictionary *dict; + NSString *appName = NULL; + + /* Determine the application name */ + dict = ( NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle()); + if (dict) + appName = [dict objectForKey: @"CFBundleName"]; + + if (![appName length]) + appName = [[NSProcessInfo processInfo] processName]; + + return appName; +} + +#if SDL_USE_NIB_FILE +/* A helper category for NSString */ +@interface NSString (ReplaceSubString) +- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString; +@end +#endif + +@interface SDLApplication : NSApplication +@end + +@implementation SDLApplication +/* Invoked from the Quit menu item */ +- (void)terminate:(id)sender +{ +#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) + (void)sender; +#endif + /* Post a SDL_QUIT event */ + SDL_Event event; + event.type = SDL_QUIT; + SDL_PushEvent(&event); +} +@end + +/* The main class of the application, the application's delegate */ +@implementation SDLMain + +/* Set the working directory to the .app's parent directory */ +- (void) setupWorkingDirectory:(BOOL)shouldChdir +{ + if (shouldChdir) + { + char parentdir[MAXPATHLEN]; + CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle()); + CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url); + if (CFURLGetFileSystemRepresentation(url2, true, (UInt8 *)parentdir, MAXPATHLEN)) + { + assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */ + } + CFRelease(url); + CFRelease(url2); + } + +} + +#if SDL_USE_NIB_FILE + +/* Fix menu to contain the real app name instead of "SDL App" */ +- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName +{ + NSRange aRange; + NSEnumerator *enumerator; + NSMenuItem *menuItem; + + aRange = [[aMenu title] rangeOfString:@"SDL App"]; + if (aRange.length != 0) + [aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]]; + + enumerator = [[aMenu itemArray] objectEnumerator]; + while ((menuItem = [enumerator nextObject])) + { + aRange = [[menuItem title] rangeOfString:@"SDL App"]; + if (aRange.length != 0) + [menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]]; + if ([menuItem hasSubmenu]) + [self fixMenu:[menuItem submenu] withAppName:appName]; + } + [ aMenu sizeToFit ]; +} + +#else + +static void setApplicationMenu(void) +{ + /* warning: this code is very odd */ + NSMenu *appleMenu; + NSMenuItem *menuItem; + NSString *title; + NSString *appName; + + appName = getApplicationName(); + appleMenu = [[NSMenu alloc] initWithTitle:@""]; + + /* Add menu items */ + title = [@"About " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; + + [appleMenu addItem:[NSMenuItem separatorItem]]; + + title = [@"Hide " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"]; + + menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"]; + [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)]; + + [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""]; + + [appleMenu addItem:[NSMenuItem separatorItem]]; + + title = [@"Quit " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"]; + + + /* Put menu into the menubar */ + menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; + [menuItem setSubmenu:appleMenu]; + [[NSApp mainMenu] addItem:menuItem]; + + /* Tell the application object that this is now the application menu */ + [NSApp setAppleMenu:appleMenu]; + + /* Finally give up our references to the objects */ + [appleMenu release]; + [menuItem release]; +} + +/* Create a window menu */ +static void setupWindowMenu(void) +{ + NSMenu *windowMenu; + NSMenuItem *windowMenuItem; + NSMenuItem *menuItem; + + windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; + + /* "Minimize" item */ + menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; + [windowMenu addItem:menuItem]; + [menuItem release]; + + /* Put menu into the menubar */ + windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; + [windowMenuItem setSubmenu:windowMenu]; + [[NSApp mainMenu] addItem:windowMenuItem]; + + /* Tell the application object that this is now the window menu */ + [NSApp setWindowsMenu:windowMenu]; + + /* Finally give up our references to the objects */ + [windowMenu release]; + [windowMenuItem release]; +} + +/* Replacement for NSApplicationMain */ +static void CustomApplicationMain (int argc, char **argv) +{ +#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) + (void)argc; + (void)argv; +#endif + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + SDLMain *sdlMain; + + /* Ensure the application object is initialised */ + [SDLApplication sharedApplication]; + +#if SDL_USE_CPS + { + CPSProcessSerNum PSN; + /* Tell the dock about us */ + if (!CPSGetCurrentProcess(&PSN)) + if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) + if (!CPSSetFrontProcess(&PSN)) + [SDLApplication sharedApplication]; + } +#endif /* SDL_USE_CPS */ + + /* Set up the menubar */ + [NSApp setMainMenu:[[NSMenu alloc] init]]; + setApplicationMenu(); + setupWindowMenu(); + + /* Create SDLMain and make it the app delegate */ + sdlMain = [[SDLMain alloc] init]; + [NSApp setDelegate:sdlMain]; + + /* Start the main event loop */ + [NSApp run]; + + [sdlMain release]; + [pool release]; +} + +#endif + +- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename +{ +#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) + (void)theApplication; +#endif + addArgument("-iwad"); + addArgument([filename UTF8String]); + return YES; +} + +/* Called when the internal event loop has just started running */ +- (void) applicationDidFinishLaunching: (NSNotification *) note +{ +#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) + (void)note; +#endif + int status; + + /* Set the working directory to the .app's parent directory */ + [self setupWorkingDirectory:gFinderLaunch]; + +#if SDL_USE_NIB_FILE + /* Set the main menu to contain the real app name instead of "SDL App" */ + [self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()]; +#endif + + if (!getenv("SRB2WADDIR")) + setenv("SRB2WADDIR", [[[NSBundle mainBundle] resourcePath] UTF8String], 1); + + /* Hand off to main application code */ + status = SDL_main (gArgc, gArgv); + + /* We're done, thank you for playing */ + exit(status); +} +@end + + +@implementation NSString (ReplaceSubString) + +- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString +{ + size_t bufferSize; + size_t selfLen = [self length]; + size_t aStringLen = [aString length]; + unichar *buffer; + NSRange localRange; + NSString *result; + + bufferSize = selfLen + aStringLen - aRange.length; + buffer = NSAllocateMemoryPages(bufferSize*sizeof(unichar)); + + /* Get first part into buffer */ + localRange.location = 0; + localRange.length = aRange.location; + [self getCharacters:buffer range:localRange]; + + /* Get middle part into buffer */ + localRange.location = 0; + localRange.length = aStringLen; + [aString getCharacters:(buffer+aRange.location) range:localRange]; + + /* Get last part into buffer */ + localRange.location = aRange.location + aRange.length; + localRange.length = selfLen - localRange.location; + [self getCharacters:(buffer+aRange.location+aStringLen) range:localRange]; + + /* Build output string */ + result = [NSString stringWithCharacters:buffer length:bufferSize]; + + NSDeallocateMemoryPages(buffer, bufferSize); + + return result; +} + +@end + + + +#ifdef main +# undef main +#endif + + +/* Main entry point to executable - should *not* be SDL_main! */ +int main (int argc, char **argv) +{ + + /* Copy the arguments into a global variable */ + + /* This is passed if we are launched by double-clicking */ + if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) { + gArgc = 1; + gFinderLaunch = YES; + } else { + gArgc = argc; + gFinderLaunch = NO; + } + gArgv = argv; + + /* Some additional arguments we always want to run with. */ + //addArgument("-opengl"); + +#if SDL_USE_NIB_FILE + [SDLApplication poseAsClass:[NSApplication class]]; + NSApplicationMain (argc, argv); +#else + CustomApplicationMain (argc, argv); +#endif + return 0; +} diff --git a/src/sdl12/SDL_main/SDL_openxdk_main.c b/src/sdl12/SDL_main/SDL_openxdk_main.c new file mode 100644 index 000000000..63db8da2d --- /dev/null +++ b/src/sdl12/SDL_main/SDL_openxdk_main.c @@ -0,0 +1,7 @@ +/* Include the SDL main definition header */ +#include "SDL_main.h" + +void XBoxStartup() +{ + SDL_main(0, NULL); /// \todo ? +} diff --git a/src/sdl12/SDL_main/SDL_win32_main.c b/src/sdl12/SDL_main/SDL_win32_main.c new file mode 100644 index 000000000..46b20d0bd --- /dev/null +++ b/src/sdl12/SDL_main/SDL_win32_main.c @@ -0,0 +1,406 @@ +/* + SDL_main.c, placed in the public domain by Sam Lantinga 4/13/98 + + The WinMain function -- calls your program's main() function +*/ + +#include +#include +#include +#include +#define RPC_NO_WINDOWS_H +#include +#include /* For _alloca() */ + +#include + +#ifdef _WIN32_WCE +# define DIR_SEPERATOR TEXT("\\") +# define _tgetcwd(str,len) wcscpy(str,TEXT("")) +# define setbuf(f,b) +# define setvbuf(w,x,y,z) +# define _tremove(x) DeleteFile(x) +#else +# define DIR_SEPERATOR TEXT("/") +# include +#endif + +/* Include the SDL main definition header */ +#ifdef _MSC_VER +#pragma warning(disable : 4214 4244) +#endif +#include "SDL.h" +#include "SDL_main.h" +#ifdef _MSC_VER +#pragma warning(default : 4214 4244) +#endif +#include "../../win32/win_dbg.h" +#define USE_MESSAGEBOX + +#ifdef main +# ifndef _WIN32_WCE_EMULATION +# undef main +# endif /* _WIN32_WCE_EMULATION */ +#endif /* main */ + +/* The standard output files */ +//#ifdef _WIN32_WCE +//#define STDOUT_FILE TEXT("/Storage Card/SRB2DEMO/stdout.txt") +//#define STDERR_FILE TEXT("/Storage Card/SRB2DEMO/stderr.txt") +//#else +#define STDOUT_FILE TEXT("stdout.txt") +#define STDERR_FILE TEXT("stderr.txt") +//#endif + +#ifndef NO_STDIO_REDIRECT + static TCHAR stdoutPath[MAX_PATH]; + static TCHAR stderrPath[MAX_PATH]; +#endif + +#if defined(_WIN32_WCE) && _WIN32_WCE < 300 +/* seems to be undefined in Win CE although in online help */ +#define isspace(a) (((CHAR)a == ' ') || ((CHAR)a == '\t')) + +/* seems to be undefined in Win CE although in online help */ +char *strrchr(char *str, int c) +{ + char *p; + + /* Skip to the end of the string */ + p=str; + while (*p) + p++; + + /* Look for the given character */ + while ( (p >= str) && (*p != (CHAR)c) ) + p--; + + /* Return NULL if character not found */ + if ( p < str ) { + p = NULL; + } + return p; +} +#endif /* _WIN32_WCE < 300 */ + +/* Parse a command line buffer into arguments */ +static int ParseCommandLine(char *cmdline, char **argv) +{ + char *bufp; + int argc; + + argc = 0; + for ( bufp = cmdline; *bufp; ) { + /* Skip leading whitespace */ + while ( isspace(*bufp) ) { + ++bufp; + } + /* Skip over argument */ + if ( *bufp == '"' ) { + ++bufp; + if ( *bufp ) { + if ( argv ) { + argv[argc] = bufp; + } + ++argc; + } + /* Skip over word */ + while ( *bufp && (*bufp != '"') ) { + ++bufp; + } + } else { + if ( *bufp ) { + if ( argv ) { + argv[argc] = bufp; + } + ++argc; + } + /* Skip over word */ + while ( *bufp && ! isspace(*bufp) ) { + ++bufp; + } + } + if ( *bufp ) { + if ( argv ) { + *bufp = '\0'; + } + ++bufp; + } + } + if ( argv ) { + argv[argc] = NULL; + } + return(argc); +} + +/* Show an error message */ +static void ShowError(const char *title, const char *message) +{ +/* If USE_MESSAGEBOX is defined, you need to link with user32.lib */ +#ifdef USE_MESSAGEBOX + MessageBoxA(NULL, + message, + title, + MB_ICONEXCLAMATION|MB_OK); +#else + fprintf(stderr, "%s: %s\n", title, message); +#endif +} + +/* Pop up an out of memory message, returns to Windows */ +static BOOL OutOfMemory(void) +{ + ShowError("Fatal Error", "Out of memory - aborting"); + return FALSE; +} + +/* Remove the output files if there was no output written */ +static void __cdecl cleanup_output(void) +{ +#ifndef NO_STDIO_REDIRECT + FILE *file; + int empty; +#endif + + /* Flush the output in case anything is queued */ + fclose(stdout); + fclose(stderr); + +#ifndef NO_STDIO_REDIRECT + /* See if the files have any output in them */ + if ( stdoutPath[0] ) { + file = _tfopen(stdoutPath, TEXT("rb")); + if ( file ) { + empty = (fgetc(file) == EOF) ? 1 : 0; + fclose(file); + if ( empty ) { + _tremove(stdoutPath); + } + } + } + if ( stderrPath[0] ) { + file = _tfopen(stderrPath, TEXT("rb")); + if ( file ) { + empty = (fgetc(file) == EOF) ? 1 : 0; + fclose(file); + if ( empty ) { + _tremove(stderrPath); + } + } + } +#endif +} + +#if defined(_MSC_VER) && !defined(_WIN32_WCE) +/* The VC++ compiler needs main defined */ +#define console_main main +#endif + +/* This is where execution begins [console apps] */ +int console_main(int argc, char *argv[]) +{ + size_t n; + int st; + char *bufp, *appname; + + /* Get the class name from argv[0] */ + appname = argv[0]; + if ( (bufp=strrchr(argv[0], '\\')) != NULL ) { + appname = bufp+1; + } else + if ( (bufp=strrchr(argv[0], '/')) != NULL ) { + appname = bufp+1; + } + + if ( (bufp=strrchr(appname, '.')) == NULL ) + n = strlen(appname); + else + n = (bufp-appname); + + bufp = (char *)alloca(n+1); + if ( bufp == NULL ) { + return OutOfMemory(); + } + strncpy(bufp, appname, n); + bufp[n] = '\0'; + appname = bufp; + + /* Load SDL dynamic link library */ + if ( SDL_Init(SDL_INIT_NOPARACHUTE) < 0 ) { + ShowError("WinMain() error", SDL_GetError()); + return(FALSE); + } + atexit(cleanup_output); + atexit(SDL_Quit); + +#ifndef DISABLE_VIDEO +#if 0 + /* Create and register our class * + DJM: If we do this here, the user nevers gets a chance to + putenv(SDL_WINDOWID). This is already called later by + the (DIB|DX5)_CreateWindow function, so it should be + safe to comment it out here. + if ( SDL_RegisterApp(appname, CS_BYTEALIGNCLIENT, + GetModuleHandle(NULL)) < 0 ) { + ShowError("WinMain() error", SDL_GetError()); + exit(1); + }*/ +#else + /* Sam: + We still need to pass in the application handle so that + DirectInput will initialize properly when SDL_RegisterApp() + is called later in the video initialization. + */ + SDL_SetModuleHandle(GetModuleHandle(NULL)); +#endif /* 0 */ +#endif /* !DISABLE_VIDEO */ + + /* Run the application main() code */ + st = SDL_main(argc, argv); + + /* Exit cleanly, calling atexit() functions */ + //exit(0); + cleanup_output(); + SDL_Quit(); + + /* Hush little compiler, don't you cry... */ + return st; +} + +/* This is where execution begins [windowed apps] */ +#ifdef _WIN32_WCE +int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPWSTR szCmdLine, int sw) +#else +int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) +#endif +{ + HINSTANCE handle; + int Result = -1; + char **argv; + int argc; + LPSTR cmdline; +#ifdef _WIN32_WCE + size_t nLen; + LPTSTR bufp; +#else + LPSTR bufp; +#endif +#ifndef NO_STDIO_REDIRECT + FILE *newfp; +#endif + + /* Start up DDHELP.EXE before opening any files, so DDHELP doesn't + keep them open. This is a hack.. hopefully it will be fixed + someday. DDHELP.EXE starts up the first time DDRAW.DLL is loaded. + */ + hPrev = hInst = NULL; + sw = 0; + handle = LoadLibrary(TEXT("DDRAW.DLL")); + if ( handle != NULL ) { + FreeLibrary(handle); + } + +#ifndef NO_STDIO_REDIRECT + _tgetcwd( stdoutPath, sizeof( stdoutPath ) ); + _tcscat( stdoutPath, DIR_SEPERATOR STDOUT_FILE ); + + /* Redirect standard input and standard output */ + newfp = _tfreopen(stdoutPath, TEXT("w"), stdout); + +#ifndef _WIN32_WCE + if ( newfp == NULL ) { /* This happens on NT */ +#if !defined(stdout) + stdout = _tfopen(stdoutPath, TEXT("w")); +#else + newfp = _tfopen(stdoutPath, TEXT("w")); + if ( newfp ) { + *stdout = *newfp; + } +#endif + } +#endif /* _WIN32_WCE */ + + _tgetcwd( stderrPath, sizeof( stderrPath ) ); + _tcscat( stderrPath, DIR_SEPERATOR STDERR_FILE ); + + newfp = _tfreopen(stderrPath, TEXT("w"), stderr); +#ifndef _WIN32_WCE + if ( newfp == NULL ) { /* This happens on NT */ +#if !defined(stderr) + stderr = _tfopen(stderrPath, TEXT("w")); +#else + newfp = _tfopen(stderrPath, TEXT("w")); + if ( newfp ) { + *stderr = *newfp; + } +#endif + } +#endif /* _WIN32_WCE */ + + setvbuf(stdout, NULL, _IOLBF, BUFSIZ); /* Line buffered */ + setbuf(stderr, NULL); /* No buffering */ +#endif /* !NO_STDIO_REDIRECT */ + +#ifdef _WIN32_WCE + nLen = wcslen(szCmdLine)+128+1; + bufp = (wchar_t *)alloca(nLen*2); + wcscpy (bufp, TEXT("\"")); + GetModuleFileName(NULL, bufp+1, 128-3); + wcscpy (bufp+wcslen(bufp), TEXT("\" ")); + wcsncpy(bufp+wcslen(bufp), szCmdLine,nLen-wcslen(bufp)); + nLen = wcslen(bufp)+1; + cmdline = (char *)alloca(nLen); + if ( cmdline == NULL ) { + return OutOfMemory(); + } + WideCharToMultiByte(CP_ACP, 0, bufp, -1, cmdline, nLen, NULL, NULL); +#else + szCmdLine = NULL; + /* Grab the command line (use alloca() on Windows) */ + bufp = GetCommandLineA(); + cmdline = (LPSTR)alloca(strlen(bufp)+1); + if ( cmdline == NULL ) { + return OutOfMemory(); + } + strcpy(cmdline, bufp); +#endif + + /* Parse it into argv and argc */ + argc = ParseCommandLine(cmdline, NULL); + argv = (char **)alloca((argc+1)*(sizeof *argv)); + if ( argv == NULL ) { + return OutOfMemory(); + } + ParseCommandLine(cmdline, argv); + +#ifdef BUGTRAP + /* Try BugTrap. */ + if(InitBugTrap()) + Result = console_main(argc, argv); + else + { +#endif + + /* Run the main program (after a little SDL initialization) */ +#ifndef _WIN32_WCE + __try +#endif + { + Result = console_main(argc, argv); + } +#ifndef _WIN32_WCE + __except ( RecordExceptionInfo(GetExceptionInformation())) + { + SetUnhandledExceptionFilter(EXCEPTION_CONTINUE_SEARCH); //Do nothing here. + } +#endif + +#ifdef BUGTRAP + } /* BT failure clause. */ + + /* This is safe even if BT didn't start. */ + ShutdownBugTrap(); +#endif + + return Result; +} diff --git a/src/sdl/SRB2CE/Makefile.cfg b/src/sdl12/SRB2CE/Makefile.cfg similarity index 100% rename from src/sdl/SRB2CE/Makefile.cfg rename to src/sdl12/SRB2CE/Makefile.cfg diff --git a/src/sdl/SRB2CE/SRB2CE.zip b/src/sdl12/SRB2CE/SRB2CE.zip similarity index 100% rename from src/sdl/SRB2CE/SRB2CE.zip rename to src/sdl12/SRB2CE/SRB2CE.zip diff --git a/src/sdl/SRB2CE/cehelp.c b/src/sdl12/SRB2CE/cehelp.c similarity index 100% rename from src/sdl/SRB2CE/cehelp.c rename to src/sdl12/SRB2CE/cehelp.c diff --git a/src/sdl/SRB2CE/cehelp.h b/src/sdl12/SRB2CE/cehelp.h similarity index 100% rename from src/sdl/SRB2CE/cehelp.h rename to src/sdl12/SRB2CE/cehelp.h diff --git a/src/sdl/SRB2DC/.gitignore b/src/sdl12/SRB2DC/.gitignore similarity index 100% rename from src/sdl/SRB2DC/.gitignore rename to src/sdl12/SRB2DC/.gitignore diff --git a/src/sdl/SRB2DC/IP.BIN b/src/sdl12/SRB2DC/IP.BIN similarity index 100% rename from src/sdl/SRB2DC/IP.BIN rename to src/sdl12/SRB2DC/IP.BIN diff --git a/src/sdl/SRB2DC/Makefile.cfg b/src/sdl12/SRB2DC/Makefile.cfg similarity index 100% rename from src/sdl/SRB2DC/Makefile.cfg rename to src/sdl12/SRB2DC/Makefile.cfg diff --git a/src/sdl/SRB2DC/SELFBOOT.BIN b/src/sdl12/SRB2DC/SELFBOOT.BIN similarity index 100% rename from src/sdl/SRB2DC/SELFBOOT.BIN rename to src/sdl12/SRB2DC/SELFBOOT.BIN diff --git a/src/sdl/SRB2DC/VMU.xbm b/src/sdl12/SRB2DC/VMU.xbm similarity index 100% rename from src/sdl/SRB2DC/VMU.xbm rename to src/sdl12/SRB2DC/VMU.xbm diff --git a/src/sdl/SRB2DC/dchelp.c b/src/sdl12/SRB2DC/dchelp.c similarity index 100% rename from src/sdl/SRB2DC/dchelp.c rename to src/sdl12/SRB2DC/dchelp.c diff --git a/src/sdl/SRB2DC/dchelp.h b/src/sdl12/SRB2DC/dchelp.h similarity index 100% rename from src/sdl/SRB2DC/dchelp.h rename to src/sdl12/SRB2DC/dchelp.h diff --git a/src/sdl/SRB2DC/i_udp.c b/src/sdl12/SRB2DC/i_udp.c similarity index 100% rename from src/sdl/SRB2DC/i_udp.c rename to src/sdl12/SRB2DC/i_udp.c diff --git a/src/sdl/SRB2DC/scramble.c b/src/sdl12/SRB2DC/scramble.c similarity index 100% rename from src/sdl/SRB2DC/scramble.c rename to src/sdl12/SRB2DC/scramble.c diff --git a/src/sdl/SRB2PS3/ICON0.png b/src/sdl12/SRB2PS3/ICON0.png similarity index 100% rename from src/sdl/SRB2PS3/ICON0.png rename to src/sdl12/SRB2PS3/ICON0.png diff --git a/src/sdl/SRB2PS3/Makefile.cfg b/src/sdl12/SRB2PS3/Makefile.cfg similarity index 100% rename from src/sdl/SRB2PS3/Makefile.cfg rename to src/sdl12/SRB2PS3/Makefile.cfg diff --git a/src/sdl/SRB2PS3/sfo.xml b/src/sdl12/SRB2PS3/sfo.xml similarity index 100% rename from src/sdl/SRB2PS3/sfo.xml rename to src/sdl12/SRB2PS3/sfo.xml diff --git a/src/sdl/SRB2PSP/ICON0.png b/src/sdl12/SRB2PSP/ICON0.png similarity index 100% rename from src/sdl/SRB2PSP/ICON0.png rename to src/sdl12/SRB2PSP/ICON0.png diff --git a/src/sdl/SRB2PSP/Makefile.cfg b/src/sdl12/SRB2PSP/Makefile.cfg similarity index 100% rename from src/sdl/SRB2PSP/Makefile.cfg rename to src/sdl12/SRB2PSP/Makefile.cfg diff --git a/src/sdl/SRB2PSP/PIC1.png b/src/sdl12/SRB2PSP/PIC1.png similarity index 100% rename from src/sdl/SRB2PSP/PIC1.png rename to src/sdl12/SRB2PSP/PIC1.png diff --git a/src/sdl/SRB2PSP/psp-prxsign/.gitignore b/src/sdl12/SRB2PSP/psp-prxsign/.gitignore similarity index 100% rename from src/sdl/SRB2PSP/psp-prxsign/.gitignore rename to src/sdl12/SRB2PSP/psp-prxsign/.gitignore diff --git a/src/sdl/SRB2PSP/psp-prxsign/Makefile b/src/sdl12/SRB2PSP/psp-prxsign/Makefile similarity index 100% rename from src/sdl/SRB2PSP/psp-prxsign/Makefile rename to src/sdl12/SRB2PSP/psp-prxsign/Makefile diff --git a/src/sdl/SRB2PSP/psp-prxsign/cmac.c b/src/sdl12/SRB2PSP/psp-prxsign/cmac.c similarity index 100% rename from src/sdl/SRB2PSP/psp-prxsign/cmac.c rename to src/sdl12/SRB2PSP/psp-prxsign/cmac.c diff --git a/src/sdl/SRB2PSP/psp-prxsign/cmac.h b/src/sdl12/SRB2PSP/psp-prxsign/cmac.h similarity index 100% rename from src/sdl/SRB2PSP/psp-prxsign/cmac.h rename to src/sdl12/SRB2PSP/psp-prxsign/cmac.h diff --git a/src/sdl/SRB2PSP/psp-prxsign/kirk_header.h b/src/sdl12/SRB2PSP/psp-prxsign/kirk_header.h similarity index 100% rename from src/sdl/SRB2PSP/psp-prxsign/kirk_header.h rename to src/sdl12/SRB2PSP/psp-prxsign/kirk_header.h diff --git a/src/sdl/SRB2PSP/psp-prxsign/main.c b/src/sdl12/SRB2PSP/psp-prxsign/main.c similarity index 100% rename from src/sdl/SRB2PSP/psp-prxsign/main.c rename to src/sdl12/SRB2PSP/psp-prxsign/main.c diff --git a/src/sdl/SRB2PSP/psp-prxsign/psp_header.h b/src/sdl12/SRB2PSP/psp-prxsign/psp_header.h similarity index 100% rename from src/sdl/SRB2PSP/psp-prxsign/psp_header.h rename to src/sdl12/SRB2PSP/psp-prxsign/psp_header.h diff --git a/src/sdl12/SRB2Pandora/Makefile.cfg b/src/sdl12/SRB2Pandora/Makefile.cfg new file mode 100644 index 000000000..c7f0f8449 --- /dev/null +++ b/src/sdl12/SRB2Pandora/Makefile.cfg @@ -0,0 +1,39 @@ +# Quick Pandora target to make a compliant SRB2 PND file. + +PNDNAME=SRB2.pnd +PNDDIR=$(BIN)/pnd +ICON=sdl/SRB2Pandora/icon.png +PXML=sdl/SRB2Pandora/PXML.xml + +SED=sed +CAT=cat +CP=cp +XARGS=xargs +FOR=for +WGET=wget -P $(PNDDIR) -c -nc + +SHXARGS:=$(XARGS) +SHSED:=$(SED) + +ifndef ECHO + CP:=@$(CP) + CAT:=@$(CAT) + SED:=@$(SED) + XARGS:=@$(XARGS) + FOR:=@(FOR) +endif + +$(BIN)/$(PNDNAME): $(BIN)/$(EXENAME) + @echo Linking $(PNDNAME)... + $(MKDIR) $(PNDDIR) + $(CP) $(BIN)/$(EXENAME) $(PNDDIR) + $(CP) $(ICON) $(PNDDIR) + $(CP) $(PXML) $(PNDDIR) +ifdef WITHDATA + $(FOR) datafile in $(shell echo $(D_FILES) | $(SHSED) 's/\.srb/\.wad/' | $(SHXARGS) -n 1 basename); do \ + $(WGET) http://alam.srb2.org/SRB2/2.0.6-Final/Resources/$$datafile; \ + done +endif + $(MKISOFS) -l -r -o $@ $(PNDDIR) + $(CAT) $(PXML) >> $@ + $(REMOVE) -r $(PNDDIR) diff --git a/src/sdl12/SRB2Pandora/PXML.xml b/src/sdl12/SRB2Pandora/PXML.xml new file mode 100644 index 000000000..33a9587db --- /dev/null +++ b/src/sdl12/SRB2Pandora/PXML.xml @@ -0,0 +1,17 @@ + + + + Sonic Robo Blast 2 + ソニック・ロボ・ブラスト・2 + A 3D Sonic fangame with a huge fanbase developing custom content, including characters, levels, and even large-scale modifications + + + + + + + + + + + diff --git a/src/sdl12/SRB2Pandora/icon.png b/src/sdl12/SRB2Pandora/icon.png new file mode 100644 index 000000000..63af73ac3 Binary files /dev/null and b/src/sdl12/SRB2Pandora/icon.png differ diff --git a/src/sdl/SRB2WII/Makefile.cfg b/src/sdl12/SRB2WII/Makefile.cfg similarity index 100% rename from src/sdl/SRB2WII/Makefile.cfg rename to src/sdl12/SRB2WII/Makefile.cfg diff --git a/src/sdl/SRB2WII/icon.png b/src/sdl12/SRB2WII/icon.png similarity index 100% rename from src/sdl/SRB2WII/icon.png rename to src/sdl12/SRB2WII/icon.png diff --git a/src/sdl/SRB2WII/meta.xml b/src/sdl12/SRB2WII/meta.xml similarity index 100% rename from src/sdl/SRB2WII/meta.xml rename to src/sdl12/SRB2WII/meta.xml diff --git a/src/sdl/SRB2XBOX/Makefile.cfg b/src/sdl12/SRB2XBOX/Makefile.cfg similarity index 100% rename from src/sdl/SRB2XBOX/Makefile.cfg rename to src/sdl12/SRB2XBOX/Makefile.cfg diff --git a/src/sdl/SRB2XBOX/xboxhelp.c b/src/sdl12/SRB2XBOX/xboxhelp.c similarity index 100% rename from src/sdl/SRB2XBOX/xboxhelp.c rename to src/sdl12/SRB2XBOX/xboxhelp.c diff --git a/src/sdl/SRB2XBOX/xboxhelp.h b/src/sdl12/SRB2XBOX/xboxhelp.h similarity index 100% rename from src/sdl/SRB2XBOX/xboxhelp.h rename to src/sdl12/SRB2XBOX/xboxhelp.h diff --git a/src/sdl12/Srb2SDL-vc10.vcxproj b/src/sdl12/Srb2SDL-vc10.vcxproj new file mode 100644 index 000000000..958cd7d02 --- /dev/null +++ b/src/sdl12/Srb2SDL-vc10.vcxproj @@ -0,0 +1,1464 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + Srb2SDL + {61BA7D3C-F77D-4D31-B718-1177FE482CF2} + Srb2SDL + + + + Application + false + + + Application + false + + + Application + false + + + Application + false + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + .\..\..\bin\VC10\$(Platform)\$(Configuration)\ + .\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\ + true + .\..\..\bin\VC10\$(Platform)\$(Configuration)\ + .\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\ + true + .\..\..\bin\VC10\$(Platform)\$(Configuration)\ + .\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\ + false + .\..\..\bin\VC10\$(Platform)\$(Configuration)\ + .\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\ + false + $(SDL12_PREFIX)\include;$(SDL12_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath) + $(SDL12_PREFIX)\include;$(SDL12_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath) + $(SDL12_PREFIX)\include;$(SDL12_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath) + $(SDL12_PREFIX)\include;$(SDL12_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath) + $(SDL12_PREFIX)\lib;$(SDL12_MIXER_PREFIX)\lib;$(LibraryPath) + $(SDL12_PREFIX)\lib;$(SDL12_MIXER_PREFIX)\lib;$(LibraryPath) + $(SDL12_PREFIX)\lib\x64;$(SDL12_MIXER_PREFIX)\lib\x64;$(LibraryPath) + $(SDL12_PREFIX)\lib\x64;$(SDL12_MIXER_PREFIX)\lib\x64;$(LibraryPath) + + + + Getting revision number from the SCM system + "$(ProjectDir)..\..\comptime.bat" "$(ProjectDir).." + + + .\..\..\bin\VC10\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.tlb + + + + + Disabled + $(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories) + _DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + $(IntDir) + $(IntDir)Srb2SDL.pdb + true + Level4 + true + true + EditAndContinue + CompileAsC + 4121;%(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + SDL.lib;SDL_mixer.lib;ws2_32.lib;%(AdditionalDependencies) + $(OutDir)srb2sdl.exe + true + true + $(OutDir)srb2sdl.pdb + Console + false + + + MachineX86 + + + true + $(OutDir)Srb2sdl.bsc + + + + + Getting revision number from the SCM system + "$(ProjectDir)..\..\comptime.bat" "$(ProjectDir).." + + + X64 + .\..\..\bin\VC10\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.tlb + + + + + Disabled + $(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories) + _DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + $(IntDir) + $(IntDir)Srb2SDL.pdb + true + Level4 + true + true + ProgramDatabase + CompileAsC + 4121;%(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + SDL.lib;SDL_mixer.lib;ws2_32.lib;%(AdditionalDependencies) + $(OutDir)srb2sdl.exe + true + true + $(OutDir)srb2sdl.pdb + Console + false + + + MachineX64 + + + true + $(OutDir)Srb2sdl.bsc + + + + + Getting revision number from the SCM system + "$(ProjectDir)..\..\comptime.bat" "$(ProjectDir).." + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\..\..\bin\VC10\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.tlb + + + + + /MP %(AdditionalOptions) + Disabled + OnlyExplicitInline + true + Speed + true + $(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories) + NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + true + MultiThreaded + .\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch + $(IntDir) + $(IntDir)Srb2SDL.pdb + true + Level3 + true + ProgramDatabase + CompileAsC + 4121;%(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + SDL.lib;SDL_mixer.lib;ws2_32.lib;%(AdditionalDependencies) + $(OutDir)srb2sdl.exe + true + true + $(OutDir)srb2sdl.pdb + Windows + false + + + MachineX86 + + + true + $(OutDir)Srb2sdl.bsc + + + + + Getting revision number from the SCM system + "$(ProjectDir)..\..\comptime.bat" "$(ProjectDir).." + + + NDEBUG;%(PreprocessorDefinitions) + true + true + X64 + .\..\..\bin\VC10\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.tlb + + + + + /MP %(AdditionalOptions) + Disabled + OnlyExplicitInline + true + Speed + true + $(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories) + NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + true + MultiThreaded + .\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch + $(IntDir) + $(IntDir)Srb2SDL.pdb + true + Level3 + true + ProgramDatabase + CompileAsC + 4121;%(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + SDL.lib;SDL_mixer.lib;ws2_32.lib;%(AdditionalDependencies) + $(OutDir)srb2sdl.exe + true + true + $(OutDir)srb2sdl.pdb + Windows + false + + + MachineX64 + + + true + $(OutDir)Srb2sdl.bsc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + true + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + true + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + true + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + true + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + true + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + true + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + true + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + true + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + true + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + true + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + true + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + true + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + true + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + true + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Compiling %(Filename).nas with NASM... + nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)" + $(IntDir)%(Filename).obj;%(Outputs) + true + Compiling %(Filename).nas with NASM... + nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)" + $(IntDir)%(Filename).obj;%(Outputs) + Compiling %(Filename).nas with NASM... + nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)" + $(IntDir)%(Filename).obj;%(Outputs) + true + Compiling %(Filename).nas with NASM... + nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)" + $(IntDir)%(Filename).obj;%(Outputs) + + + Compiling %(Filename).nas with NASM... + nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)" + $(IntDir)%(Filename).obj;%(Outputs) + true + Compiling %(Filename).nas with NASM... + nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)" + $(IntDir)%(Filename).obj;%(Outputs) + Compiling %(Filename).nas with NASM... + nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)" + $(IntDir)%(Filename).obj;%(Outputs) + true + Compiling %(Filename).nas with NASM... + nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)" + $(IntDir)%(Filename).obj;%(Outputs) + + + Compiling %(Filename).nas with NASM... + nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)" + $(IntDir)%(Filename).obj;%(Outputs) + true + Compiling %(Filename).nas with NASM... + nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)" + $(IntDir)%(Filename).obj;%(Outputs) + Compiling %(Filename).nas with NASM... + nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)" + $(IntDir)%(Filename).obj;%(Outputs) + true + Compiling %(Filename).nas with NASM... + nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)" + $(IntDir)%(Filename).obj;%(Outputs) + + + + + + + + + + %(PreprocessorDefinitions) + \Users\alam\svn\srb2mods\SRB2\branches\ALAM\src\win32;%(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + \Users\alam\svn\srb2mods\SRB2\branches\ALAM\src\win32;%(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + \Users\alam\svn\srb2mods\SRB2\branches\ALAM\src\win32;%(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + \Users\alam\svn\srb2mods\SRB2\branches\ALAM\src\win32;%(AdditionalIncludeDirectories) + + + + + {72b01aca-7a1a-4f7b-acef-2607299cf052} + false + + + {73a5729c-7323-41d4-ab48-8a03c9f81603} + false + + + + + + diff --git a/src/sdl12/Srb2SDL-vc9.vcproj b/src/sdl12/Srb2SDL-vc9.vcproj new file mode 100644 index 000000000..d2a268f8d --- /dev/null +++ b/src/sdl12/Srb2SDL-vc9.vcproj @@ -0,0 +1,5845 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/sdl12/Srb2SDL.dsp b/src/sdl12/Srb2SDL.dsp new file mode 100644 index 000000000..879113ca2 --- /dev/null +++ b/src/sdl12/Srb2SDL.dsp @@ -0,0 +1,1057 @@ +# Microsoft Developer Studio Project File - Name="Srb2SDL" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=Srb2SDL - 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 "Srb2SDL.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 "Srb2SDL.mak" CFG="Srb2SDL - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Srb2SDL - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "Srb2SDL - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Srb2SDL - 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 "..\..\bin\VC\Release\SDL" +# PROP Intermediate_Dir "..\..\objs\VC\Release\SDL" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +MTL=midl.exe +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /G5 /W3 /GX /Zi /Ot /Og /Oi /Op /Oy /Ob1 /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "NDEBUG" /D "SDLMAIN" /D "NO_STDIO_REDIRECT" /D "USE_WGL_SWAP" /D "DIRECTFULLSCREEN" /D "HAVE_SDL" /D "HWRENDER" /D "HW3SOUND" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GF /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +# SUBTRACT RSC /x +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo /o"..\..\objs\SDL\Release\SRB2.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 SDL.lib SDL_mixer.lib user32.lib advapi32.lib ws2_32.lib /nologo /subsystem:windows /pdb:"C:\srb2demo2\srb2sdl.pdb" /debug /machine:I386 /out:"C:\srb2demo2\srb2sdl.exe" +# SUBTRACT LINK32 /profile /pdb:none /incremental:yes + +!ELSEIF "$(CFG)" == "Srb2SDL - 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 "..\..\bin\VC\Debug\SDL" +# PROP Intermediate_Dir "..\..\objs\VC\Debug\SDL" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +MTL=midl.exe +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /G6 /W4 /WX /Gm /GX /ZI /Od /Op /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "_DEBUG" /D "USE_WGL_SWAP" /D "DIRECTFULLSCREEN" /D "HAVE_SDL" /D "HWRENDER" /D "HW3SOUND" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GZ /c +# SUBTRACT CPP /YX +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +# SUBTRACT RSC /x +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo /o"..\..\objs\SDL\Debug\SRB2.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 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:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 SDL.lib SDL_mixer.lib user32.lib advapi32.lib ws2_32.lib /nologo /subsystem:console /pdb:"C:\srb2demo2\srb2sdldebug.pdb" /debug /machine:I386 /out:"C:\srb2demo2\srb2sdldebug.exe" /pdbtype:sept +# SUBTRACT LINK32 /pdb:none + +!ENDIF + +# Begin Target + +# Name "Srb2SDL - Win32 Release" +# Name "Srb2SDL - Win32 Debug" +# Begin Group "SDLapp" + +# PROP Default_Filter "" +# Begin Group "filter" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\filter\filters.c +# End Source File +# Begin Source File + +SOURCE=.\filter\filters.h +# End Source File +# Begin Source File + +SOURCE=.\filter\hq2x.c +# End Source File +# Begin Source File + +SOURCE=.\filter\hq2x.h +# End Source File +# Begin Source File + +SOURCE=.\filter\interp.h +# End Source File +# Begin Source File + +SOURCE=.\filter\lq2x.c +# End Source File +# Begin Source File + +SOURCE=.\filter\lq2x.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\dosstr.c +# End Source File +# Begin Source File + +SOURCE=.\endtxt.c +# End Source File +# Begin Source File + +SOURCE=.\endtxt.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=.\hwsym_sdl.c +# End Source File +# Begin Source File + +SOURCE=.\hwsym_sdl.h +# End Source File +# Begin Source File + +SOURCE=.\i_cdmus.c +# End Source File +# Begin Source File + +SOURCE=.\i_main.c +# End Source File +# Begin Source File + +SOURCE=.\i_net.c +# End Source File +# Begin Source File + +SOURCE=.\i_sound.c +# End Source File +# Begin Source File + +SOURCE=.\i_system.c +# End Source File +# Begin Source File + +SOURCE=.\i_video.c +# End Source File +# Begin Source File + +SOURCE=.\IMG_xpm.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=.\ogl_sdl.c +# End Source File +# Begin Source File + +SOURCE=.\ogl_sdl.h +# End Source File +# Begin Source File + +SOURCE=..\hardware\r_opengl\r_opengl.c +# End Source File +# Begin Source File + +SOURCE=..\hardware\r_opengl\r_opengl.h +# End Source File +# Begin Source File + +SOURCE=.\SDL_icon.xpm +# End Source File +# Begin Source File + +SOURCE=.\SDL_main\SDL_win32_main.c + +!IF "$(CFG)" == "Srb2SDL - Win32 Release" + +!ELSEIF "$(CFG)" == "Srb2SDL - Win32 Debug" + +# PROP Exclude_From_Build 1 + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\sdlmain.h +# End Source File +# Begin Source File + +SOURCE=..\win32\Srb2win.rc +# End Source File +# Begin Source File + +SOURCE=..\win32\win_dbg.c +# End Source File +# Begin Source File + +SOURCE=..\win32\win_dbg.h +# End Source File +# Begin Source File + +SOURCE=..\win32\win_main.h +# 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)" == "Srb2SDL - Win32 Release" + +# PROP Ignore_Default_Tool 1 +# Begin Custom Build - Compiling $(InputName).nas with NASM... +IntDir=.\..\..\objs\VC\Release\SDL +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)" == "Srb2SDL - Win32 Debug" + +# PROP Ignore_Default_Tool 1 +# Begin Custom Build - Compiling $(InputName).nas with NASM... +IntDir=.\..\..\objs\VC\Debug\SDL +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)" == "Srb2SDL - Win32 Release" + +# PROP Ignore_Default_Tool 1 +# Begin Custom Build - Compiling $(InputName).nas with NASM... +IntDir=.\..\..\objs\VC\Release\SDL +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)" == "Srb2SDL - Win32 Debug" + +# PROP Ignore_Default_Tool 1 +# Begin Custom Build - Compiling $(InputName).nas with NASM... + +IntDir=.\..\..\objs\VC\Debug\SDL +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)" == "Srb2SDL - Win32 Release" + +# Begin Custom Build - Compiling $(InputName).nas with NASM... +IntDir=.\..\..\objs\VC\Release\SDL +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)" == "Srb2SDL - Win32 Debug" + +# Begin Custom Build - Compiling $(InputName).nas with NASM... +IntDir=.\..\..\objs\VC\Debug\SDL +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_glide.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\hw_trick.c +# 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=..\win32\Srb2win.ico +# End Source File +# End Target +# End Project diff --git a/src/sdl12/Srb2SDL.dsw b/src/sdl12/Srb2SDL.dsw new file mode 100644 index 000000000..4f8f7bdce --- /dev/null +++ b/src/sdl12/Srb2SDL.dsw @@ -0,0 +1,74 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "Srb2SDL"=.\Srb2SDL.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: "s_openal"=..\hardware\s_openal\s_openal.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "zlib"=..\..\libs\zlib\projects\visualc6\zlib.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/src/sdl12/Srb2SDL.ico b/src/sdl12/Srb2SDL.ico new file mode 100644 index 000000000..5ab791af3 Binary files /dev/null and b/src/sdl12/Srb2SDL.ico differ diff --git a/src/sdl12/dosstr.c b/src/sdl12/dosstr.c new file mode 100644 index 000000000..f9bbee9b4 --- /dev/null +++ b/src/sdl12/dosstr.c @@ -0,0 +1,38 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// This file is in the public domain. +// (Re)written by Graue in 2006. +// +//----------------------------------------------------------------------------- +/// \file +/// \brief String uppercasing/lowercasing functions for non-DOS non-Win32 +/// systems + +#include "../doomtype.h" + +#ifndef HAVE_DOSSTR_FUNCS + +#include + +int strupr(char *n) +{ + while (*n != '\0') + { + *n = toupper(*n); + n++; + } + return 1; +} + +int strlwr(char *n) +{ + while (*n != '\0') + { + *n = tolower(*n); + n++; + } + return 1; +} + +#endif diff --git a/src/sdl12/endtxt.c b/src/sdl12/endtxt.c new file mode 100644 index 000000000..1d7756b4d --- /dev/null +++ b/src/sdl12/endtxt.c @@ -0,0 +1,236 @@ +/* + * Function to write the SRB2 end message text + * + * Copyright (C) 1998 by Udo Munk + * + * This code is provided AS IS and there are no guarantees, none. + * Feel free to share and modify. + */ +//----------------------------------------------------------------------------- +/// \file +/// \brief Support to show ENDOOM text +/// +/// Loads the lump ENDOOM, set up the console to print +/// out the colors and text + +#include +#include + +// need this 19990118 by Kin +#include "../doomdef.h" +#include "../w_wad.h" +#include "../z_zone.h" +#include "endtxt.h" +/** \brief The ShowEndTxt function + + + Prints out the ENDOOM the way DOOM.EXE/DOOM2.EXE did for Win32 or Linux/GNU + + \return void + + +*/ + +void ShowEndTxt(void) +{ +#if !(defined (_WIN32_WCE) || defined (_XBOX) || defined (_arch_dreamcast)) + INT32 i; + UINT16 j, att = 0; + INT32 nlflag = 1; +#ifdef _WIN32 + HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE); + DWORD mode, bytesWritten; + CONSOLE_SCREEN_BUFFER_INFO backupcon; + COORD resizewin = {80,-1}; + CHAR let = 0; +#endif + UINT16 *ptext; + void *data; + lumpnum_t endoomnum = W_GetNumForName("ENDOOM"); + //char *col; + + /* if the xterm has more then 80 columns we need to add nl's */ + /* doesn't work, COLUMNS is not in the environment at this time ??? + col = I_getenv("COLUMNS"); + if (col) { + if (atoi(col) > 80) + nlflag++; + } + */ + + /* get the lump with the text */ + data = ptext = W_CacheLumpNum(endoomnum, PU_CACHE); + +#ifdef _WIN32 + if (co == INVALID_HANDLE_VALUE || GetFileType(co) != FILE_TYPE_CHAR || !GetConsoleMode(co, &mode)) // test if it a good handle + { + Z_Free(data); + return; + } + + 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 second + 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 +#else + /* print 80x25 text and deal with the attributes too */ + for (i=1; i<=80*25; i++) { + /* attribute first */ + /* attribute changed? */ + if ((j = *ptext >> 8) != att) { + /* save current attribute */ + att = j; + /* set new attribute, forground color first */ + printf("\033["); + switch (j & 0x0f) { + case 0: /* black */ + printf("30"); + break; + case 1: /* blue */ + printf("34"); + break; + case 2: /* green */ + printf("32"); + break; + case 3: /* cyan */ + printf("36"); + break; + case 4: /* red */ + printf("31"); + break; + case 5: /* magenta */ + printf("35"); + break; + case 6: /* brown */ + printf("33"); + break; + case 7: /* bright grey */ + printf("37"); + break; + case 8: /* dark grey */ + printf("1;30"); + break; + case 9: /* bright blue */ + printf("1;34"); + break; + case 10: /* bright green */ + printf("1;32"); + break; + case 11: /* bright cyan */ + printf("1;36"); + break; + case 12: /* bright red */ + printf("1;31"); + break; + case 13: /* bright magenta */ + printf("1;35"); + break; + case 14: /* yellow */ + printf("1;33"); + break; + case 15: /* white */ + printf("1;37"); + break; + } + printf("m"); + /* now background color */ + printf("\033["); + switch ((j >> 4) & 0x0f) { + case 0: /* black */ + printf("40"); + break; + case 1: /* blue */ + printf("44"); + break; + case 2: /* green */ + printf("42"); + break; + case 3: /* cyan */ + printf("46"); + break; + case 4: /* red */ + printf("41"); + break; + case 5: /* magenta */ + printf("45"); + break; + case 6: /* brown */ + printf("43"); + break; + case 7: /* bright grey */ + printf("47"); + break; + case 8: /* dark grey */ + printf("1;40"); + break; + case 9: /* bright blue */ + printf("1;44"); + break; + case 10: /* bright green */ + printf("1;42"); + break; + case 11: /* bright cyan */ + printf("1;46"); + break; + case 12: /* bright red */ + printf("1;41"); + break; + case 13: /* bright magenta */ + printf("1;45"); + break; + case 14: /* yellow */ + printf("1;43"); + break; + case 15: /* white */ + printf("1;47"); + break; + } + printf("m"); + } + + /* now the text */ + printf("%c",*ptext++ & 0xff); + + /* do we need a nl? */ + if (nlflag) + { + if (!(i % 80)) + { + printf("\033[0m"); + att = 0; + printf("\n"); + } + } + } + /* all attributes off */ + printf("\033[0m"); +#endif + if (nlflag) + printf("\n"); + + Z_Free(data); +#endif +} diff --git a/src/sdl12/endtxt.h b/src/sdl12/endtxt.h new file mode 100644 index 000000000..41f8e51ad --- /dev/null +++ b/src/sdl12/endtxt.h @@ -0,0 +1,24 @@ +// 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 Support to show ENDOOM text + +#ifndef __ENDTXT__ +#define __ENDTXT__ + +void ShowEndTxt (void); + +#endif diff --git a/src/sdl/filter/filters.c b/src/sdl12/filter/filters.c similarity index 100% rename from src/sdl/filter/filters.c rename to src/sdl12/filter/filters.c diff --git a/src/sdl/filter/filters.h b/src/sdl12/filter/filters.h similarity index 100% rename from src/sdl/filter/filters.h rename to src/sdl12/filter/filters.h diff --git a/src/sdl/filter/hq2x.c b/src/sdl12/filter/hq2x.c similarity index 100% rename from src/sdl/filter/hq2x.c rename to src/sdl12/filter/hq2x.c diff --git a/src/sdl/filter/hq2x.h b/src/sdl12/filter/hq2x.h similarity index 100% rename from src/sdl/filter/hq2x.h rename to src/sdl12/filter/hq2x.h diff --git a/src/sdl/filter/interp.h b/src/sdl12/filter/interp.h similarity index 100% rename from src/sdl/filter/interp.h rename to src/sdl12/filter/interp.h diff --git a/src/sdl/filter/lq2x.c b/src/sdl12/filter/lq2x.c similarity index 100% rename from src/sdl/filter/lq2x.c rename to src/sdl12/filter/lq2x.c diff --git a/src/sdl/filter/lq2x.h b/src/sdl12/filter/lq2x.h similarity index 100% rename from src/sdl/filter/lq2x.h rename to src/sdl12/filter/lq2x.h diff --git a/src/sdl/filter/main.c b/src/sdl12/filter/main.c similarity index 100% rename from src/sdl/filter/main.c rename to src/sdl12/filter/main.c diff --git a/src/sdl12/hwsym_sdl.c b/src/sdl12/hwsym_sdl.c new file mode 100644 index 000000000..44ddf830c --- /dev/null +++ b/src/sdl12/hwsym_sdl.c @@ -0,0 +1,183 @@ +// 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 Tool for dynamic referencing of hardware rendering functions +/// +/// Declaration and definition of the HW rendering +/// functions do have the same name. Originally, the +/// implementation was stored in a separate library. +/// For SDL, we need some function to return the addresses, +/// otherwise we have a conflict with the compiler. + +#include "hwsym_sdl.h" +#include "../doomdef.h" + +#ifdef _MSC_VER +#pragma warning(disable : 4214 4244) +#endif + +#ifdef HAVE_SDL + +#include "SDL.h" + +#ifdef _MSC_VER +#pragma warning(default : 4214 4244) +#endif + +#if defined (_XBOX) || defined (_arch_dreamcast) || defined(GP2X) +#define NOLOADSO +#endif + +#if SDL_VERSION_ATLEAST(1,2,6) && !defined (NOLOADSO) +#include "SDL_loadso.h" // 1.2.6+ +#elif !defined (NOLOADSO) +#define NOLOADSO +#endif + +#define _CREATE_DLL_ // necessary for Unix AND Windows + +#ifdef HWRENDER +#include "../hardware/hw_drv.h" +#include "ogl_sdl.h" +#ifdef STATIC_OPENGL +#include "../hardware/r_opengl/r_opengl.h" +#endif +#endif + +#ifdef HW3SOUND +#include "../hardware/hw3dsdrv.h" +#endif + +#define GETFUNC(func) \ + else if (0 == strcmp(#func, funcName)) \ + funcPointer = &func \ +// +// +/** \brief The *hwSym function + + Stupid function to return function addresses + + \param funcName the name of the function + \param handle an object to look in(NULL for self) + + \return void +*/ +// +void *hwSym(const char *funcName,void *handle) +{ + void *funcPointer = NULL; +#ifdef HWRENDER + if (0 == strcmp("SetPalette", funcName)) + funcPointer = &OglSdlSetPalette; + GETFUNC(Init); + GETFUNC(Draw2DLine); + GETFUNC(DrawPolygon); + GETFUNC(SetBlend); + GETFUNC(ClearBuffer); + GETFUNC(SetTexture); + GETFUNC(ReadRect); + GETFUNC(GClipRect); + GETFUNC(ClearMipMapCache); + GETFUNC(SetSpecialState); + GETFUNC(GetTextureUsed); + GETFUNC(DrawMD2); + GETFUNC(DrawMD2i); + GETFUNC(SetTransform); + GETFUNC(GetRenderVersion); +#ifdef SHUFFLE + GETFUNC(PostImgRedraw); +#endif //SHUFFLE + GETFUNC(StartScreenWipe); + GETFUNC(EndScreenWipe); + GETFUNC(DoScreenWipe); + GETFUNC(DrawIntermissionBG); + GETFUNC(MakeScreenTexture); +#else //HWRENDER + if (0 == strcmp("FinishUpdate", funcName)) + return funcPointer; //&FinishUpdate; +#endif //!HWRENDER +#ifdef STATIC3DS + GETFUNC(Startup); + GETFUNC(AddSfx); + GETFUNC(AddSource); + GETFUNC(StartSource); + GETFUNC(StopSource); + GETFUNC(GetHW3DSVersion); + GETFUNC(BeginFrameUpdate); + GETFUNC(EndFrameUpdate); + GETFUNC(IsPlaying); + GETFUNC(UpdateListener); + GETFUNC(UpdateSourceParms); + GETFUNC(SetGlobalSfxVolume); + GETFUNC(SetCone); + GETFUNC(Update3DSource); + GETFUNC(ReloadSource); + GETFUNC(KillSource); + GETFUNC(Shutdown); + GETFUNC(GetHW3DSTitle); +#endif +#ifdef NOLOADSO + else + funcPointer = handle; +#else + else if (handle) + funcPointer = SDL_LoadFunction(handle,funcName); +#endif + if (!funcPointer) + I_OutputMsg("hwSym for %s: %s\n", funcName, SDL_GetError()); + return funcPointer; +} + +/** \brief The *hwOpen function + + \param hwfile Open a handle to the SO + + \return Handle to SO + + +*/ + +void *hwOpen(const char *hwfile) +{ +#ifdef NOLOADSO + (void)hwfile; + return NULL; +#else + void *tempso = NULL; + tempso = SDL_LoadObject(hwfile); + if (!tempso) I_OutputMsg("hwOpen of %s: %s\n", hwfile, SDL_GetError()); + return tempso; +#endif +} + +/** \brief The hwClose function + + \param handle Close the handle of the SO + + \return void + + +*/ + +void hwClose(void *handle) +{ +#ifdef NOLOADSO + (void)handle; +#else + SDL_UnloadObject(handle); +#endif +} +#endif diff --git a/src/sdl12/hwsym_sdl.h b/src/sdl12/hwsym_sdl.h new file mode 100644 index 000000000..7297587bf --- /dev/null +++ b/src/sdl12/hwsym_sdl.h @@ -0,0 +1,23 @@ +// 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 Tool for dynamic referencing of hardware rendering/3D sound functions + +void *hwSym(const char *funcName,void *handle); + +void *hwOpen(const char *hwfile); + +void hwClose(void *handle); diff --git a/src/sdl12/i_cdmus.c b/src/sdl12/i_cdmus.c new file mode 100644 index 000000000..1eeac370b --- /dev/null +++ b/src/sdl12/i_cdmus.c @@ -0,0 +1,588 @@ +// 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 +/// + +#ifdef HAVE_SDL + +#if defined (DC) || defined (_WIN32_WCE) || defined(GP2X) || defined(_PS3) +#define NOSDLCD +#endif + +#include +#ifndef NOSDLCD + +#ifdef _MSC_VER +#pragma warning(disable : 4214 4244) +#endif + +#include "SDL.h" + +#ifdef _MSC_VER +#pragma warning(default : 4214 4244) +#endif + +#endif + +#include "../doomtype.h" +#include "../i_sound.h" +#include "../command.h" +#include "../m_argv.h" +#include "../s_sound.h" + +#define MAX_CD_TRACKS 256 + +#ifdef _XBOX +INT32 SDL_SYS_CDInit(void) +{ + return(0); +} + +void SDL_SYS_CDQuit(void) +{ + return; +} +#endif + +UINT8 cdaudio_started = 0; // for system startup/shutdown + +consvar_t cd_volume = {"cd_volume","31",CV_SAVE,soundvolume_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cdUpdate = {"cd_update","1",CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; + +#ifndef NOSDLCD +static SDL_bool cdValid = SDL_FALSE; +static SDL_bool cdPlaying = SDL_FALSE; +static SDL_bool wasPlaying = SDL_FALSE; +static SDL_bool cdEnabled = SDL_FALSE; +static SDL_bool playLooping = SDL_FALSE; +static Uint8 playTrack = 0; +static Uint8 maxTrack = MAX_CD_TRACKS-1; +static Uint8 cdRemap[MAX_CD_TRACKS]; +static INT32 cdvolume = -1; +static SDL_CD *cdrom = NULL; +static CDstatus cdStatus = CD_ERROR; + +/************************************************************************** + * + * function: CDAudio_GetAudioDiskInfo + * + * description: + * set number of tracks if CD is available + * + **************************************************************************/ +static INT32 CDAudio_GetAudioDiskInfo(void) +{ + cdValid = SDL_FALSE; + maxTrack = 0; + + if (!cdrom) + return 0;//Alam: Lies! + + cdStatus = SDL_CDStatus(cdrom); + + if (!CD_INDRIVE(cdStatus)) + { + CONS_Printf("%s", M_GetText("No CD in drive\n")); + return -1; + } + + if (cdStatus == CD_ERROR) + { + CONS_Printf(M_GetText("CD Error: %s\n"), SDL_GetError()); + return -1; + } + + cdValid = SDL_TRUE; + maxTrack = (Uint8)cdrom->numtracks; + + return 0; +} + + +/************************************************************************** + * + * function: I_EjectCD + * + * description: + * + * + **************************************************************************/ +static void I_EjectCD(void) +{ + if (!cdrom || !cdEnabled) + return; // no cd init'd + + I_StopCD(); + + if (SDL_CDEject(cdrom)) + CONS_Printf("%s", M_GetText("CD eject failed\n")); +} + +/************************************************************************** + * + * function: Command_Cd_f + * + * description: + * handles all CD commands from the console + * + **************************************************************************/ +static void Command_Cd_f (void) +{ + const char *command; + size_t ret, n; + + if (!cdaudio_started) + return; + + if (COM_Argc() < 2) + { + CONS_Printf ("%s", M_GetText("cd [on] [off] [remap] [reset] [select]\n" + " [open] [info] [play ] [resume]\n" + " [stop] [pause] [loop ]\n")); + return; + } + + command = COM_Argv (1); + + if (!strncmp(command, "on", 2)) + { + cdEnabled = SDL_TRUE; + return; + } + + if (!strncmp(command, "off", 3)) + { + I_StopCD(); + cdEnabled = SDL_FALSE; + return; + } + + if (!strncmp(command, "select", 6)) + { + INT32 newcddrive; + newcddrive = atoi(COM_Argv(2)); + command = SDL_CDName(newcddrive); + I_StopCD(); + cdEnabled = SDL_FALSE; + SDL_CDClose(cdrom); + cdrom = SDL_CDOpen(newcddrive); + if (cdrom) + { + cdEnabled = SDL_TRUE; + CONS_Printf(M_GetText("Opened CD-ROM drive %s\n"), command ? command : COM_Argv(2)); + } + else CONS_Printf(M_GetText("Couldn't open CD-ROM drive %s: %s\n"), command ? command : COM_Argv(2), SDL_GetError()); + return; + } + + if (!strncmp(command, "remap", 5)) + { + ret = COM_Argc() - 2; + if (ret <= 0) + { + for (n = 1; n < MAX_CD_TRACKS; n++) + { + if (cdRemap[n] != n) + CONS_Printf(" %s -> %u\n", sizeu1(n), cdRemap[n]); + } + return; + } + for (n = 1; n <= ret; n++) + cdRemap[n] = (Uint8)atoi(COM_Argv (n+1)); + return; + } + + if (!strncmp(command, "reset", 5)) + { + if (!cdrom) return; + cdEnabled = SDL_TRUE; + I_StopCD(); + for (n = 0; n < MAX_CD_TRACKS; n++) + cdRemap[n] = (Uint8)n; + CDAudio_GetAudioDiskInfo(); + return; + } + + if (!cdValid) + { + if (CDAudio_GetAudioDiskInfo()==-1 && !cdValid) + { + CONS_Printf("%s", M_GetText("No CD in drive\n")); + return; + } + } + + if (!strncmp(command, "open", 4)) + { + I_EjectCD(); + cdValid = SDL_FALSE; + return; + } + + if (!strncmp(command, "info", 4)) + { + CONS_Printf(M_GetText("%u tracks\n"), maxTrack); + if (cdPlaying) + CONS_Printf(M_GetText("Currently %s track %u\n"), playLooping ? M_GetText("looping") : M_GetText("playing"), playTrack); + else if (wasPlaying) + CONS_Printf(M_GetText("Paused %s track %u\n"), playLooping ? M_GetText("looping") : M_GetText("playing"), playTrack); + CONS_Printf(M_GetText("Volume is %d\n"), cdvolume); + return; + } + + if (!strncmp(command, "play", 4)) + { + I_PlayCD((UINT8)atoi(COM_Argv (2)), SDL_FALSE); + return; + } + + if (!strncmp(command, "loop", 4)) + { + I_PlayCD((UINT8)atoi(COM_Argv (2)), true); + return; + } + + if (!strncmp(command, "stop", 4)) + { + I_StopCD(); + return; + } + if (!strncmp(command, "pause", 5)) + { + I_PauseCD(); + return; + } + + if (!strncmp(command, "resume", 6)) + { + I_ResumeCD(); + return; + } + + CONS_Printf(M_GetText("Invalid CD command \"CD %s\"\n"), COM_Argv(1)); +} +#endif + +/************************************************************************** + * + * function: StopCD + * + * description: + * + * + **************************************************************************/ +void I_StopCD(void) +{ +#ifndef NOSDLCD + if (!cdrom || !cdEnabled) + return; + + if (!(cdPlaying || wasPlaying)) + return; + + if (SDL_CDStop(cdrom)) + I_OutputMsg("cdromstop failed\n"); + + wasPlaying = SDL_FALSE; + cdPlaying = SDL_FALSE; +#endif +} + +/************************************************************************** + * + * function: PauseCD + * + * description: + * + * + **************************************************************************/ +void I_PauseCD (void) +{ +#ifndef NOSDLCD + if (!cdrom || !cdEnabled) + return; + + if (!cdPlaying) + return; + + if (SDL_CDPause(cdrom)) + I_OutputMsg("cdrompause failed\n"); + + wasPlaying = cdPlaying; + cdPlaying = SDL_FALSE; +#endif +} + +/************************************************************************** + * + * function: ResumeCD + * + * description: + * + * + **************************************************************************/ +// continue after a pause +void I_ResumeCD (void) +{ +#ifndef NOSDLCD + if (!cdrom || !cdEnabled) + return; + + if (!cdValid) + return; + + if (!wasPlaying) + return; + + if (cd_volume.value == 0) + return; + + if (SDL_CDResume(cdrom)) + I_OutputMsg("cdromresume failed\n"); + + cdPlaying = SDL_TRUE; + wasPlaying = SDL_FALSE; +#endif +} + + +/************************************************************************** + * + * function: ShutdownCD + * + * description: + * + * + **************************************************************************/ +void I_ShutdownCD (void) +{ +#ifndef NOSDLCD + if (!cdaudio_started) + return; + + I_StopCD(); + + CONS_Printf("I_ShutdownCD: "); + SDL_CDClose(cdrom); + cdrom = NULL; + cdaudio_started = false; + CONS_Printf("%s", M_GetText("shut down\n")); + SDL_QuitSubSystem(SDL_INIT_CDROM); + cdEnabled = SDL_FALSE; +#endif +} + +/************************************************************************** + * + * function: InitCD + * + * description: + * Initialize the first CD drive SDL detects and add console command 'cd' + * + **************************************************************************/ +void I_InitCD (void) +{ +#ifndef NOSDLCD + INT32 i; + + // Has been checked in d_main.c, but doesn't hurt here + if (M_CheckParm ("-nocd")) + return; + + CONS_Printf("%s", M_GetText("I_InitCD: Init CD audio\n")); + + // Initialize SDL first + if (SDL_InitSubSystem(SDL_INIT_CDROM) < 0) + { + CONS_Printf(M_GetText("Couldn't initialize SDL CDROM: %s\n"), SDL_GetError()); + return; + } + + // Open drive + cdrom = SDL_CDOpen(0); + + if (!cdrom) + { + const char *cdName = SDL_CDName(0); + if (!cdName) + CONS_Printf(M_GetText("Couldn't open CD-ROM drive %s: %s\n"), "\b", SDL_GetError()); + else + CONS_Printf(M_GetText("Couldn't open CD-ROM drive %s: %s\n"), cdName, SDL_GetError()); + //return; + } + + for (i = 0; i < MAX_CD_TRACKS; i++) + cdRemap[i] = (Uint8)i; + + cdaudio_started = true; + if (cdrom) cdEnabled = SDL_TRUE; + + if (CDAudio_GetAudioDiskInfo()==-1) + { + CONS_Printf("%s", M_GetText("No CD in drive\n")); + cdValid = SDL_FALSE; + } + + COM_AddCommand ("cd", Command_Cd_f); + + CONS_Printf("%s", M_GetText("CD audio Initialized\n")); +#endif +} + + + +// +/************************************************************************** + * + * function: UpdateCD + * + * description: + * sets CD volume (may have changed) and initiates play evey 2 seconds + * in case the song has elapsed + * + **************************************************************************/ +void I_UpdateCD (void) +{ +#ifndef NOSDLCD + static Uint32 lastchk = 0; + + if (!cdEnabled || !cdrom) + return; + + I_SetVolumeCD(cd_volume.value); + + if (cdPlaying && lastchk < SDL_GetTicks()) + { + lastchk = SDL_GetTicks() + 2000; //two seconds between chks + + if (CDAudio_GetAudioDiskInfo()==-1) + { + cdPlaying = SDL_FALSE; + return; + } + + if (cdStatus != CD_PLAYING && cdStatus != CD_PAUSED) + { + cdPlaying = SDL_FALSE; + if (playLooping) + I_PlayCD(playTrack, true); + } + } +#endif +} + + + +/************************************************************************** + * + * function: PlayCD + * + * description: + * play the requested track and set the looping flag + * pauses the CD if volume is 0 + * + **************************************************************************/ + +void I_PlayCD (UINT8 track, UINT8 looping) +{ +#ifdef NOSDLCD + (void)track; + (void)looping; +#else + if (!cdrom || !cdEnabled) + return; + + if (!cdValid) + { + CDAudio_GetAudioDiskInfo(); + if (!cdValid) + return; + } + + track = cdRemap[track]; + + if (track < 1 || track > maxTrack) + { + CONS_Printf(M_GetText("Bad track number %u.\n"), track); + return; + } + + // don't try to play a non-audio track + if (cdrom->track[track].type == SDL_DATA_TRACK) + { + CONS_Printf(M_GetText("Track %u is not audio\n"), track); + return; + } + + if (cdPlaying) + { + if (playTrack == track) + return; + I_StopCD(); + } + + if (SDL_CDPlayTracks(cdrom, track, 0, 1, 0)) + { + CONS_Printf(M_GetText("Error playing track %d: %s\n"), track, SDL_GetError()); + return; + } + + playLooping = looping; + playTrack = (Uint8)track; + cdPlaying = SDL_TRUE; + + if (cd_volume.value == 0) + I_PauseCD(); +#endif +} + + +/************************************************************************** + * + * function: SetVolumeCD + * + * description: + * SDL does not support setting the CD volume + * use pause instead and toggle between full and no music + * + **************************************************************************/ + +boolean I_SetVolumeCD (INT32 volume) +{ +#ifdef NOSDLCD + (void)volume; +#else + if (volume != cdvolume) + { + if (volume > 0 && volume < 16) + { + CV_SetValue(&cd_volume, 31); + cdvolume = 31; + I_ResumeCD(); + } + else if (volume > 15 && volume < 31) + { + CV_SetValue(&cd_volume, 0); + cdvolume = 0; + I_PauseCD(); + } + } +#endif + return false; +} + +#endif diff --git a/src/sdl12/i_main.c b/src/sdl12/i_main.c new file mode 100644 index 000000000..1c438e083 --- /dev/null +++ b/src/sdl12/i_main.c @@ -0,0 +1,247 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright (C) 1993-1996 by id Software, Inc. +// 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 Main program, simply calls D_SRB2Main and D_SRB2Loop, the high level loop. + +#include "../doomdef.h" +#include "../m_argv.h" +#include "../d_main.h" +#include "../i_system.h" + +#ifdef __GNUC__ +#include +#endif + +#ifdef _WII +#include +#include +#include +#ifdef REMOTE_DEBUGGING +#include +#endif +static char wiicwd[PATH_MAX] = "sd:/"; +static char localip[16] = {0}; +static char gateway[16] = {0}; +static char netmask[16] = {0}; +#endif + +#ifdef _PSP +#include +#include +PSP_HEAP_SIZE_KB(24*1024); +PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER | PSP_THREAD_ATTR_VFPU); +PSP_MAIN_THREAD_NAME("SRB2"); +PSP_MAIN_THREAD_STACK_SIZE_KB(256); +#endif + +#ifdef HAVE_SDL + +#ifdef HAVE_TTF +#include "SDL.h" +#include "i_ttf.h" +#endif + +#ifdef SDLMAIN +#include "SDL_main.h" +#elif defined(FORCESDLMAIN) +extern int SDL_main(int argc, char *argv[]); +#endif + +#ifdef LOGMESSAGES +FILE *logstream = NULL; +#endif + +#ifndef DOXYGEN +#ifndef O_TEXT +#define O_TEXT 0 +#endif + +#ifndef O_SEQUENTIAL +#define O_SEQUENTIAL 0 +#endif +#endif + +#if defined (_WIN32) && !defined (_XBOX) +#include "../win32/win_dbg.h" +typedef BOOL (WINAPI *p_IsDebuggerPresent)(VOID); +#endif + +#ifdef _arch_dreamcast +#include +KOS_INIT_FLAGS(INIT_DEFAULT +//| INIT_NET +//| INIT_MALLOCSTATS +//| INIT_QUIET +//| INIT_OCRAM +//| INIT_NO_DCLOAD +); +#endif + +#if defined (_WIN32) && !defined (_XBOX) && !defined (_WIN32_WCE) +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 +} +#endif + + +/** \brief The main function + + \param argc number of arg + \param *argv string table + + \return int +*/ +FUNCNORETURN +#if defined (_XBOX) && defined (__GNUC__) +void XBoxStartup() +{ + const char *logdir = NULL; + myargc = -1; + myargv = NULL; +#else +#ifdef FORCESDLMAIN +int SDL_main(int argc, char **argv) +#else +int main(int argc, char **argv) +#endif +{ + const char *logdir = NULL; + myargc = argc; + myargv = argv; /// \todo pull out path to exe from this string +#endif + +#ifdef HAVE_TTF +#ifdef _PS3 + // apparently there is a bug in SDL_PSL1GHT which needs this to be set to work around + SDL_setenv("SDL_VIDEODRIVER", "psl1ght", 1); + I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO, SDL_SWSURFACE|SDL_DOUBLEBUF); +#elif defined(_WIN32) + I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO|SDL_INIT_AUDIO, SDL_SWSURFACE); +#else + I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO, SDL_SWSURFACE); +#endif +#endif + +#ifdef _PS3 + // initialise controllers. + //ioPadInit(7); +#endif + +// init Wii-specific stuff +#ifdef _WII + // Start network + if_config(localip, netmask, gateway, TRUE); + +#ifdef REMOTE_DEBUGGING +#if REMOTE_DEBUGGING == 0 + DEBUG_Init(GDBSTUB_DEVICE_TCP, GDBSTUB_DEF_TCPPORT); // Port 2828 +#elif REMOTE_DEBUGGING > 2 + DEBUG_Init(GDBSTUB_DEVICE_TCP, REMOTE_DEBUGGING); // Custom Port +#elif REMOTE_DEBUGGING < 0 + DEBUG_Init(GDBSTUB_DEVICE_USB, GDBSTUB_DEF_CHANNEL); // Slot 1 +#else + DEBUG_Init(GDBSTUB_DEVICE_USB, REMOTE_DEBUGGING-1); // Custom Slot +#endif +#endif + // Start FAT filesystem + fatInitDefault(); + + if (getcwd(wiicwd, PATH_MAX)) + I_PutEnv(va("HOME=%ssrb2wii", wiicwd)); +#endif + + logdir = D_Home(); + +#ifdef LOGMESSAGES +#if defined(_WIN32_WCE) || defined(GP2X) + logstream = fopen(va("%s.log",argv[0]), "a"); +#elif defined (_WII) + logstream = fopen(va("%s/srb2log.txt",logdir), "a"); +#elif defined (DEFAULTDIR) + if (logdir) + logstream = fopen(va("%s/"DEFAULTDIR"/srb2log.txt",logdir), "a"); + else +#endif + logstream = fopen("./srb2log.txt", "a"); +#endif + + //I_OutputMsg("I_StartupSystem() ...\n"); + I_StartupSystem(); +#if defined (_WIN32) && !defined (_XBOX) +#ifndef _WIN32_WCE + { + p_IsDebuggerPresent pfnIsDebuggerPresent = (p_IsDebuggerPresent)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsDebuggerPresent"); + if ((!pfnIsDebuggerPresent || !pfnIsDebuggerPresent()) +#ifdef BUGTRAP + && !InitBugTrap() +#endif + ) + { + LoadLibraryA("exchndl.dll"); + } + } +#endif + prevExceptionFilter = SetUnhandledExceptionFilter(RecordExceptionInfo); +#ifndef _WIN32_WCE + MakeCodeWritable(); +#endif +#endif + // startup SRB2 + CONS_Printf("%s", M_GetText("Setting up SRB2...\n")); + D_SRB2Main(); + CONS_Printf("%s", M_GetText("Entering main game loop...\n")); + // never return + D_SRB2Loop(); + +#ifdef BUGTRAP + // This is safe even if BT didn't start. + ShutdownBugTrap(); +#endif + + // return to OS +#ifndef __GNUC__ + return 0; +#endif +} +#endif diff --git a/src/sdl12/i_net.c b/src/sdl12/i_net.c new file mode 100644 index 000000000..ee4a34c13 --- /dev/null +++ b/src/sdl12/i_net.c @@ -0,0 +1,442 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright (C) 1993-1996 by id Software, Inc. +// Portions 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 SDL network interface + +#include "../doomdef.h" + +#include "../i_system.h" +#include "../d_event.h" +#include "../d_net.h" +#include "../m_argv.h" + +#include "../doomstat.h" + +#include "../i_net.h" + +#include "../z_zone.h" + +#include "../i_tcp.h" + +#ifdef HAVE_SDL + +#ifdef HAVE_SDLNET + +#include "SDL_net.h" + +#define MAXBANS 20 + +static IPaddress clientaddress[MAXNETNODES+1]; +static IPaddress banned[MAXBANS]; + +static UDPpacket mypacket; +static UDPsocket mysocket = NULL; +static SDLNet_SocketSet myset = NULL; + +static size_t numbans = 0; +static boolean NET_bannednode[MAXNETNODES+1]; /// \note do we really need the +1? +static boolean init_SDLNet_driver = false; + +static const char *NET_AddrToStr(IPaddress* sk) +{ + static char s[22]; // 255.255.255.255:65535 + strcpy(s, SDLNet_ResolveIP(sk)); + if (sk->port != 0) strcat(s, va(":%d", sk->port)); + return s; +} + +static const char *NET_GetNodeAddress(INT32 node) +{ + if (!nodeconnected[node]) + return NULL; + return NET_AddrToStr(&clientaddress[node]); +} + +static const char *NET_GetBanAddress(size_t ban) +{ + if (ban > numbans) + return NULL; + return NET_AddrToStr(&banned[ban]); +} + +static boolean NET_cmpaddr(IPaddress* a, IPaddress* b) +{ + return (a->host == b->host && (b->port == 0 || a->port == b->port)); +} + +static boolean NET_CanGet(void) +{ + return myset?(SDLNet_CheckSockets(myset,0) == 1):false; +} + +static void NET_Get(void) +{ + INT32 mystatus; + INT32 newnode; + mypacket.len = MAXPACKETLENGTH; + if (!NET_CanGet()) + { + doomcom->remotenode = -1; // no packet + return; + } + mystatus = SDLNet_UDP_Recv(mysocket,&mypacket); + if (mystatus != -1) + { + if (mypacket.channel != -1) + { + doomcom->remotenode = mypacket.channel+1; // good packet from a game player + doomcom->datalength = mypacket.len; + return; + } + newnode = SDLNet_UDP_Bind(mysocket,-1,&mypacket.address); + if (newnode != -1) + { + size_t i; + newnode++; + M_Memcpy(&clientaddress[newnode], &mypacket.address, sizeof (IPaddress)); + DEBFILE(va("New node detected: node:%d address:%s\n", newnode, + NET_GetNodeAddress(newnode))); + doomcom->remotenode = newnode; // good packet from a game player + doomcom->datalength = mypacket.len; + for (i = 0; i < numbans; i++) + { + if (NET_cmpaddr(&mypacket.address, &banned[i])) + { + DEBFILE("This dude has been banned\n"); + NET_bannednode[newnode] = true; + break; + } + } + if (i == numbans) + NET_bannednode[newnode] = false; + return; + } + else + I_OutputMsg("SDL_Net: %s",SDLNet_GetError()); + } + else if (mystatus == -1) + { + I_OutputMsg("SDL_Net: %s",SDLNet_GetError()); + } + + DEBFILE("New node detected: No more free slots\n"); + doomcom->remotenode = -1; // no packet +} + +#if 0 +static boolean NET_CanSend(void) +{ + return true; +} +#endif + +static void NET_Send(void) +{ + if (!doomcom->remotenode) + return; + mypacket.len = doomcom->datalength; + if (SDLNet_UDP_Send(mysocket,doomcom->remotenode-1,&mypacket) == 0) + { + I_OutputMsg("SDL_Net: %s",SDLNet_GetError()); + } +} + +static void NET_FreeNodenum(INT32 numnode) +{ + // can't disconnect from self :) + if (!numnode) + return; + + DEBFILE(va("Free node %d (%s)\n", numnode, NET_GetNodeAddress(numnode))); + + SDLNet_UDP_Unbind(mysocket,numnode-1); + + memset(&clientaddress[numnode], 0, sizeof (IPaddress)); +} + +static UDPsocket NET_Socket(void) +{ + UDPsocket temp = NULL; + Uint16 portnum = 0; + IPaddress tempip = {INADDR_BROADCAST,0}; + //Hurdler: I'd like to put a server and a client on the same computer + //Logan: Me too + //BP: in fact for client we can use any free port we want i have read + // in some doc that connect in udp can do it for us... + //Alam: where? + if (M_CheckParm("-clientport")) + { + if (!M_IsNextParm()) + I_Error("syntax: -clientport "); + portnum = atoi(M_GetNextParm()); + } + else + portnum = sock_port; + temp = SDLNet_UDP_Open(portnum); + if (!temp) + { + I_OutputMsg("SDL_Net: %s",SDLNet_GetError()); + return NULL; + } + if (SDLNet_UDP_Bind(temp,BROADCASTADDR-1,&tempip) == -1) + { + I_OutputMsg("SDL_Net: %s",SDLNet_GetError()); + SDLNet_UDP_Close(temp); + return NULL; + } + clientaddress[BROADCASTADDR].port = sock_port; + clientaddress[BROADCASTADDR].host = INADDR_BROADCAST; + + doomcom->extratics = 1; // internet is very high ping + + return temp; +} + +static void I_ShutdownSDLNetDriver(void) +{ + if (myset) SDLNet_FreeSocketSet(myset); + myset = NULL; + SDLNet_Quit(); + init_SDLNet_driver = false; +} + +static void I_InitSDLNetDriver(void) +{ + if (init_SDLNet_driver) + I_ShutdownSDLNetDriver(); + if (SDLNet_Init() == -1) + { + I_OutputMsg("SDL_Net: %s",SDLNet_GetError()); + return; // No good! + } + D_SetDoomcom(); + mypacket.data = doomcom->data; + init_SDLNet_driver = true; +} + +static void NET_CloseSocket(void) +{ + if (mysocket) + SDLNet_UDP_Close(mysocket); + mysocket = NULL; +} + +static SINT8 NET_NetMakeNodewPort(const char *hostname, const char *port) +{ + INT32 newnode; + UINT16 portnum = sock_port; + IPaddress hostnameIP; + + // retrieve portnum from address! + if (port && !port[0]) + portnum = atoi(port); + + if (SDLNet_ResolveHost(&hostnameIP,hostname,portnum) == -1) + { + I_OutputMsg("SDL_Net: %s",SDLNet_GetError()); + return -1; + } + newnode = SDLNet_UDP_Bind(mysocket,-1,&hostnameIP); + if (newnode == -1) + { + I_OutputMsg("SDL_Net: %s",SDLNet_GetError()); + return newnode; + } + newnode++; + M_Memcpy(&clientaddress[newnode],&hostnameIP,sizeof (IPaddress)); + return (SINT8)newnode; +} + + +static boolean NET_OpenSocket(void) +{ + memset(clientaddress, 0, sizeof (clientaddress)); + + //I_OutputMsg("SDL_Net Code starting up\n"); + + I_NetSend = NET_Send; + I_NetGet = NET_Get; + I_NetCloseSocket = NET_CloseSocket; + I_NetFreeNodenum = NET_FreeNodenum; + I_NetMakeNodewPort = NET_NetMakeNodewPort; + + //I_NetCanSend = NET_CanSend; + + // build the socket but close it first + NET_CloseSocket(); + mysocket = NET_Socket(); + + if (!mysocket) + return false; + + // for select + myset = SDLNet_AllocSocketSet(1); + if (!myset) + { + I_OutputMsg("SDL_Net: %s",SDLNet_GetError()); + return false; + } + if (SDLNet_UDP_AddSocket(myset,mysocket) == -1) + { + I_OutputMsg("SDL_Net: %s",SDLNet_GetError()); + return false; + } + return true; +} + +static boolean NET_Ban(INT32 node) +{ + if (numbans == MAXBANS) + return false; + + M_Memcpy(&banned[numbans], &clientaddress[node], sizeof (IPaddress)); + banned[numbans].port = 0; + numbans++; + return true; +} + +static boolean NET_SetBanAddress(const char *address, const char *mask) +{ + (void)mask; + if (bans == MAXBANS) + return false; + + if (SDLNet_ResolveHost(&banned[numbans], address, 0) == -1) + return false; + numbans++; + return true; +} + +static void NET_ClearBans(void) +{ + numbans = 0; +} +#endif + +// +// I_InitNetwork +// Only required for DOS, so this is more a dummy +// +boolean I_InitNetwork(void) +{ +#ifdef HAVE_SDLNET + char serverhostname[255]; + boolean ret = false; + SDL_version SDLcompiled; + const SDL_version *SDLlinked = SDLNet_Linked_Version(); + SDL_NET_VERSION(&SDLcompiled) + I_OutputMsg("Compiled for SDL_Net version: %d.%d.%d\n", + SDLcompiled.major, SDLcompiled.minor, SDLcompiled.patch); + I_OutputMsg("Linked with SDL_Net version: %d.%d.%d\n", + SDLlinked->major, SDLlinked->minor, SDLlinked->patch); + //if (!M_CheckParm ("-sdlnet")) + // return false; + // initilize the driver + I_InitSDLNetDriver(); + I_AddExitFunc(I_ShutdownSDLNetDriver); + if (!init_SDLNet_driver) + return false; + + if (M_CheckParm("-udpport")) + { + if (M_IsNextParm()) + sock_port = (UINT16)atoi(M_GetNextParm()); + else + sock_port = 0; + } + + // parse network game options, + if (M_CheckParm("-server") || dedicated) + { + server = true; + + // If a number of clients (i.e. nodes) is specified, the server will wait for the clients + // to connect before starting. + // If no number is specified here, the server starts with 1 client, and others can join + // in-game. + // Since Boris has implemented join in-game, there is no actual need for specifying a + // particular number here. + // FIXME: for dedicated server, numnodes needs to be set to 0 upon start +/* if (M_IsNextParm()) + doomcom->numnodes = (INT16)atoi(M_GetNextParm()); + else */if (dedicated) + doomcom->numnodes = 0; + else + doomcom->numnodes = 1; + + if (doomcom->numnodes < 0) + doomcom->numnodes = 0; + if (doomcom->numnodes > MAXNETNODES) + doomcom->numnodes = MAXNETNODES; + + // server + servernode = 0; + // FIXME: + // ??? and now ? + // server on a big modem ??? 4*isdn + net_bandwidth = 16000; + hardware_MAXPACKETLENGTH = INETPACKETLENGTH; + + ret = true; + } + else if (M_CheckParm("-connect")) + { + if (M_IsNextParm()) + strcpy(serverhostname, M_GetNextParm()); + else + serverhostname[0] = 0; // assuming server in the LAN, use broadcast to detect it + + // server address only in ip + if (serverhostname[0]) + { + COM_BufAddText("connect \""); + COM_BufAddText(serverhostname); + COM_BufAddText("\"\n"); + + // probably modem + hardware_MAXPACKETLENGTH = INETPACKETLENGTH; + } + else + { + // so we're on a LAN + COM_BufAddText("connect any\n"); + + net_bandwidth = 800000; + hardware_MAXPACKETLENGTH = MAXPACKETLENGTH; + } + } + + mypacket.maxlen = hardware_MAXPACKETLENGTH; + I_NetOpenSocket = NET_OpenSocket; + I_Ban = NET_Ban; + I_ClearBans = NET_ClearBans; + I_GetNodeAddress = NET_GetNodeAddress; + I_GetBenAddress = NET_GetBenAddress; + I_SetBanAddress = NET_SetBanAddress; + bannednode = NET_bannednode; + + return ret; +#else + if ( M_CheckParm ("-net") ) + { + I_Error("-net not supported, use -server and -connect\n" + "see docs for more\n"); + } + return false; +#endif +} +#endif diff --git a/src/sdl12/i_system.c b/src/sdl12/i_system.c new file mode 100644 index 000000000..888a6a507 --- /dev/null +++ b/src/sdl12/i_system.c @@ -0,0 +1,3115 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright (C) 1993-1996 by id Software, Inc. +// Portions 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. +// +// Changes by Graue are in the public domain. +// +//----------------------------------------------------------------------------- +/// \file +/// \brief SRB2 system stuff for SDL + +#ifndef _WIN32_WCE +#include +#endif + +#ifdef _XBOX +#include "SRB2XBOX/xboxhelp.h" +#endif + +#if defined (_WIN32) && !defined (_XBOX) +#define RPC_NO_WINDOWS_H +#include +#include "../doomtype.h" +#ifndef _WIN32_WCE +typedef BOOL (WINAPI *p_GetDiskFreeSpaceExA)(LPCSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER); +typedef BOOL (WINAPI *p_IsProcessorFeaturePresent) (DWORD); +typedef DWORD (WINAPI *p_timeGetTime) (void); +typedef UINT (WINAPI *p_timeEndPeriod) (UINT); +typedef HANDLE (WINAPI *p_OpenFileMappingA) (DWORD, BOOL, LPCSTR); +typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); +typedef HANDLE (WINAPI *p_GetCurrentProcess) (VOID); +typedef BOOL (WINAPI *p_GetProcessAffinityMask) (HANDLE, PDWORD_PTR, PDWORD_PTR); +typedef BOOL (WINAPI *p_SetProcessAffinityMask) (HANDLE, DWORD_PTR); +#endif +#endif +#include +#include +#include +#ifdef __GNUC__ +#include +#elif defined (_MSC_VER) +#include +#endif +#if defined (__unix__) || defined (UNIXCOMMON) +#include +#endif + +#ifdef _arch_dreamcast +#include +#include +#include +#include +void __set_fpscr(long); // in libgcc / kernel's startup.s? +#else +#include +#if defined (_WIN32) && !defined (_WIN32_WCE) && !defined (_XBOX) +#include +#endif +#endif + +#ifdef _MSC_VER +#pragma warning(disable : 4214 4244) +#endif + +#ifdef HAVE_SDL + +#include "SDL.h" + +#ifdef HAVE_TTF +#include "i_ttf.h" +#endif + +#ifdef _MSC_VER +#pragma warning(default : 4214 4244) +#endif + +#if SDL_VERSION_ATLEAST(1,2,7) && !defined (DC) +#include "SDL_cpuinfo.h" // 1.2.7 or greater +#define HAVE_SDLCPUINFO +#endif + +#ifdef _PSP +//#include +#elif !defined(_PS3) +#if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (_arch_dreamcast) && !defined (__HAIKU__) && !defined (_WII)) +#if defined (__linux__) +#include +#else +#include +#include +/*For meminfo*/ +#include +#ifdef FREEBSD +#include +#endif +#include +#include +#endif +#endif +#endif + +#ifndef _PS3 +#if defined (__linux__) || (defined (UNIXCOMMON) && !defined (_arch_dreamcast) && !defined (_PSP) && !defined (__HAIKU__) && !defined (_WII)) +#ifndef NOTERMIOS +#include +#include // ioctl +#define HAVE_TERMIOS +#endif +#endif +#endif + +#ifndef NOMUMBLE +#if defined (__linux__) && !defined(_PS3) // need -lrt +#include +#ifdef MAP_FAILED +#define HAVE_SHM +#endif +#include +#endif + +#if defined (_WIN32) && !defined (_WIN32_WCE) && !defined (_XBOX) +#define HAVE_MUMBLE +#define WINMUMBLE +#elif defined (HAVE_SHM) +#define HAVE_MUMBLE +#endif +#endif // NOMUMBLE + +#ifdef _WIN32_WCE +#include "SRB2CE/cehelp.h" +#endif + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + +// Locations for searching the srb2.srb +#ifdef _arch_dreamcast +#define DEFAULTWADLOCATION1 "/cd" +#define DEFAULTWADLOCATION2 "/pc" +#define DEFAULTWADLOCATION3 "/pc/home/alam/srb2code/data" +#define DEFAULTSEARCHPATH1 "/cd" +#define DEFAULTSEARCHPATH2 "/pc" +//#define DEFAULTSEARCHPATH3 "/pc/home/alam/srb2code/data" +#elif defined (GP2X) +#define DEFAULTWADLOCATION1 "/mnt/sd" +#define DEFAULTWADLOCATION2 "/mnt/sd/SRB2" +#define DEFAULTWADLOCATION3 "/tmp/mnt/sd" +#define DEFAULTWADLOCATION4 "/tmp/mnt/sd/SRB2" +#define DEFAULTSEARCHPATH1 "/mnt/sd" +#define DEFAULTSEARCHPATH2 "/tmp/mnt/sd" +#elif defined (_WII) +#define NOCWD +#define NOHOME +#define NEED_SDL_GETENV +#define DEFAULTWADLOCATION1 "sd:/srb2wii" +#define DEFAULTWADLOCATION2 "usb:/srb2wii" +#define DEFAULTSEARCHPATH1 "sd:/srb2wii" +#define DEFAULTSEARCHPATH2 "usb:/srb2wii" +// PS3: TODO: this will need modification most likely +#elif defined (_PS3) +#define NOCWD +#define NOHOME +#define DEFAULTWADLOCATION1 "/dev_hdd0/game/SRB2-PS3_/USRDIR/etc" +#define DEFAULTWADLOCATION2 "/dev_usb/SRB2PS3" +#define DEFAULTSEARCHPATH1 "/dev_hdd0/game/SRB2-PS3_/USRDIR/etc" +#define DEFAULTSEARCHPATH2 "/dev_usb/SRB2PS3" +#elif defined (_PSP) +#define NOCWD +#define NOHOME +#define DEFAULTWADLOCATION1 "host0:/bin/Resources" +#define DEFAULTWADLOCATION2 "ms0:/PSP/GAME/SRB2PSP" +#define DEFAULTSEARCHPATH1 "host0:/" +#define DEFAULTSEARCHPATH2 "ms0:/PSP/GAME/SRB2PSP" +#elif defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) +#define DEFAULTWADLOCATION1 "/usr/local/share/games/SRB2" +#define DEFAULTWADLOCATION2 "/usr/local/games/SRB2" +#define DEFAULTWADLOCATION3 "/usr/share/games/SRB2" +#define DEFAULTWADLOCATION4 "/usr/games/SRB2" +#define DEFAULTSEARCHPATH1 "/usr/local/games" +#define DEFAULTSEARCHPATH2 "/usr/games" +#define DEFAULTSEARCHPATH3 "/usr/local" +#elif defined (_XBOX) +#define NOCWD +#ifdef __GNUC__ +#include +#endif +#define DEFAULTWADLOCATION1 "c:\\srb2" +#define DEFAULTWADLOCATION2 "d:\\srb2" +#define DEFAULTWADLOCATION3 "e:\\srb2" +#define DEFAULTWADLOCATION4 "f:\\srb2" +#define DEFAULTWADLOCATION5 "g:\\srb2" +#define DEFAULTWADLOCATION6 "h:\\srb2" +#define DEFAULTWADLOCATION7 "i:\\srb2" +#elif defined (_WIN32_WCE) +#define NOCWD +#define NOHOME +#define DEFAULTWADLOCATION1 "\\Storage Card\\SRB2DEMO" +#define DEFAULTSEARCHPATH1 "\\Storage Card" +#elif defined (_WIN32) +#define DEFAULTWADLOCATION1 "c:\\games\\srb2" +#define DEFAULTWADLOCATION2 "\\games\\srb2" +#define DEFAULTSEARCHPATH1 "c:\\games" +#define DEFAULTSEARCHPATH2 "\\games" +#endif + +/** \brief WAD file to look for +*/ +#define WADKEYWORD1 "srb2.srb" +#define WADKEYWORD2 "srb2.wad" +/** \brief holds wad path +*/ +static char returnWadPath[256]; + +//Alam_GBC: SDL + +#include "../doomdef.h" +#include "../m_misc.h" +#include "../i_video.h" +#include "../i_sound.h" +#include "../i_system.h" +#include "../screen.h" //vid.WndParent +#include "../d_net.h" +#include "../g_game.h" +#include "../filesrch.h" +#include "endtxt.h" +#include "sdlmain.h" + +#include "../i_joy.h" + +#include "../m_argv.h" + +#ifdef MAC_ALERT +#include "macosx/mac_alert.h" +#endif + +#include "../d_main.h" + +#if !defined(NOMUMBLE) && defined(HAVE_MUMBLE) +// Mumble context string +#include "../d_clisrv.h" +#include "../byteptr.h" +#endif + +/** \brief The JoyReset function + + \param JoySet Joystick info to reset + + \return void +*/ +static void JoyReset(SDLJoyInfo_t *JoySet) +{ + if (JoySet->dev) + { +#ifdef GP2X //GP2X's SDL does an illegal free on the 1st joystick... + if (SDL_JoystickIndex(JoySet->dev) != 0) +#endif + SDL_JoystickClose(JoySet->dev); + } + JoySet->dev = NULL; + JoySet->oldjoy = -1; + JoySet->axises = JoySet->buttons = JoySet->hats = JoySet->balls = 0; + //JoySet->scale +} + +/** \brief First joystick up and running +*/ +static INT32 joystick_started = 0; + +/** \brief SDL info about joystick 1 +*/ +SDLJoyInfo_t JoyInfo; + + +/** \brief Second joystick up and running +*/ +static INT32 joystick2_started = 0; + +/** \brief SDL inof about joystick 2 +*/ +SDLJoyInfo_t JoyInfo2; + +#ifdef HAVE_TERMIOS +static INT32 fdmouse2 = -1; +static INT32 mouse2_started = 0; +#endif + +SDL_bool consolevent = SDL_FALSE; +SDL_bool framebuffer = SDL_FALSE; + +UINT8 keyboard_started = false; + +#if 0 +static void signal_handler(INT32 num) +{ + //static char msg[] = "oh no! back to reality!\r\n"; + char * sigmsg; + char sigdef[32]; + + 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; +#if !(defined (__unix_) || defined (UNIXCOMMON)) + case SIGBREAK: + sigmsg = "Ctrl-Break sequence"; + break; +#endif + case SIGABRT: + sigmsg = "abnormal termination triggered by abort call"; + break; + default: + sprintf(sigdef,"signal number %d", num); + sigmsg = sigdef; + } + + I_OutputMsg("signal_handler() error: %s\n", sigmsg); + signal(num, SIG_DFL); //default signal action + raise(num); + I_Quit(); +} +#endif + +#if defined (NDEBUG) && !defined (DC) && !defined (_WIN32_WCE) +FUNCNORETURN static ATTRNORETURN void quit_handler(int num) +{ + signal(num, SIG_DFL); //default signal action + raise(num); + I_Quit(); +} +#endif + +#ifdef HAVE_TERMIOS +// TERMIOS console code from Quake3: thank you! +SDL_bool stdin_active = SDL_TRUE; + +typedef struct +{ + size_t cursor; + char buffer[256]; +} feild_t; + +feild_t tty_con; + +// when printing general stuff to stdout stderr (Sys_Printf) +// we need to disable the tty console stuff +// this increments so we can recursively disable +static INT32 ttycon_hide = 0; +// some key codes that the terminal may be using +// TTimo NOTE: I'm not sure how relevant this is +static INT32 tty_erase; +static INT32 tty_eof; + +static struct termios tty_tc; + +// ============================================================= +// tty console routines +// NOTE: if the user is editing a line when something gets printed to the early console then it won't look good +// so we provide tty_Clear and tty_Show to be called before and after a stdout or stderr output +// ============================================================= + +// flush stdin, I suspect some terminals are sending a LOT of garbage +// FIXME TTimo relevant? +#if 0 +static inline void tty_FlushIn(void) +{ + char key; + while (read(STDIN_FILENO, &key, 1)!=-1); +} +#endif + +// do a backspace +// TTimo NOTE: it seems on some terminals just sending '\b' is not enough +// so for now, in any case we send "\b \b" .. yeah well .. +// (there may be a way to find out if '\b' alone would work though) +static void tty_Back(void) +{ + char key; + ssize_t d; + key = '\b'; + d = write(STDOUT_FILENO, &key, 1); + key = ' '; + d = write(STDOUT_FILENO, &key, 1); + key = '\b'; + d = write(STDOUT_FILENO, &key, 1); + (void)d; +} + +static void tty_Clear(void) +{ + size_t i; + if (tty_con.cursor>0) + { + for (i=0; i0); + ttycon_hide--; + if (ttycon_hide == 0 && tty_con.cursor) + { + for (i=0; i 0) + { + tty_con.cursor--; + tty_con.buffer[tty_con.cursor] = '\0'; + tty_Back(); + } + ev.data1 = KEY_BACKSPACE; + } + else if (key < ' ') // check if this is a control char + { + if (key == '\n') + { + tty_Clear(); + tty_con.cursor = 0; + ev.data1 = KEY_ENTER; + } + else return; + } + else + { + // push regular character + ev.data1 = tty_con.buffer[tty_con.cursor] = key; + tty_con.cursor++; + // print the current line (this is differential) + d = write(STDOUT_FILENO, &key, 1); + } + if (ev.data1) D_PostEvent(&ev); + //tty_FlushIn(); + (void)d; +} + +#elif defined (_WIN32) && !(defined (_XBOX) || defined (_WIN32_WCE)) +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 boolean entering_con_command = false; + +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) + { + memset(&ev,0x00,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.data1 = KEY_NULL; + break; + case VK_SHIFT: + ev.data1 = KEY_LSHIFT; + break; + case VK_RETURN: + entering_con_command = false; + // Fall through. + default: + ev.data1 = 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.data1 && ev.data1 != KEY_LSHIFT && ev.data1 != 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.data1 = KEY_LSHIFT; + break; + default: + break; + } + } + if (ev.data1) D_PostEvent(&ev); + break; + case MOUSE_EVENT: + case WINDOW_BUFFER_SIZE_EVENT: + case MENU_EVENT: + case FOCUS_EVENT: + break; + } + } +} + +static void I_StartupConsole(void) +{ + HANDLE ci, co; + const INT32 ded = M_CheckParm("-dedicated"); +#ifdef SDLMAIN + BOOL gotConsole = FALSE; + if (M_CheckParm("-console") || ded) + gotConsole = AllocConsole(); +#else + BOOL gotConsole = TRUE; + if (M_CheckParm("-detachconsole")) + { + FreeConsole(); + gotConsole = AllocConsole(); + } +#ifdef _DEBUG + else if (M_CheckParm("-noconsole") && !ded) +#else + else if (!M_CheckParm("-console") && !ded) +#endif + { + FreeConsole(); + gotConsole = FALSE; + } +#endif + + if (gotConsole) + { + SetConsoleTitleA("SRB2 Console"); + consolevent = SDL_TRUE; + } + + //Let get the real console HANDLE, because Mingw's Bash is bad! + ci = CreateFile(TEXT("CONIN$") , GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + co = CreateFile(TEXT("CONOUT$"), GENERIC_WRITE|GENERIC_READ, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (ci != INVALID_HANDLE_VALUE) + { + const DWORD CM = ENABLE_LINE_INPUT|ENABLE_ECHO_INPUT|ENABLE_PROCESSED_INPUT; + SetStdHandle(STD_INPUT_HANDLE, ci); + if (GetFileType(ci) == FILE_TYPE_CHAR) + SetConsoleMode(ci, CM); //default mode but no ENABLE_MOUSE_INPUT + } + if (co != INVALID_HANDLE_VALUE) + { + SetStdHandle(STD_OUTPUT_HANDLE, co); + SetStdHandle(STD_ERROR_HANDLE, co); + } +} +static inline void I_ShutdownConsole(void){} +#else +void I_GetConsoleEvents(void){} +static inline void I_StartupConsole(void) +{ +#ifdef _arch_dreamcast + char title[] = "SRB2 for Dreamcast!\n"; + __set_fpscr(0x00040000); /* ignore FPU underflow */ + //printf("\nHello world!\n\n"); + pvr_init_defaults(); + conio_init(CONIO_TTY_PVR, CONIO_INPUT_LINE); + conio_set_theme(CONIO_THEME_MATRIX); + conio_clear(); + conio_putstr(title); + //printf("\nHello world!\n\n"); +#endif +#ifdef _DEBUG + consolevent = !M_CheckParm("-noconsole"); +#else + consolevent = M_CheckParm("-console"); +#endif + + framebuffer = M_CheckParm("-framebuffer"); + + if (framebuffer) + consolevent = SDL_FALSE; +} +static inline void I_ShutdownConsole(void){} +#endif + +// +// StartupKeyboard +// +void I_StartupKeyboard (void) +{ +#if defined (NDEBUG) && !defined (DC) +#ifdef SIGILL +// signal(SIGILL , signal_handler); +#endif +#ifdef SIGINT + signal(SIGINT , quit_handler); +#endif +#ifdef SIGSEGV +// signal(SIGSEGV , signal_handler); +#endif +#ifdef SIGBREAK + signal(SIGBREAK , quit_handler); +#endif +#ifdef SIGABRT +// signal(SIGABRT , signal_handler); +#endif +#ifdef SIGTERM + signal(SIGTERM , quit_handler); +#endif +#endif +} + +// +//I_OutputMsg +// +void I_OutputMsg(const char *fmt, ...) +{ + size_t len; + XBOXSTATIC char txt[8192]; + va_list argptr; + +#ifdef _arch_dreamcast + if (!keyboard_started) conio_printf(fmt); +#endif + + va_start(argptr,fmt); + vsprintf(txt, fmt, argptr); + va_end(argptr); + +#ifdef HAVE_TTF + if (TTF_WasInit()) I_TTFDrawText(currentfont, solid, DEFAULTFONTFGR, DEFAULTFONTFGG, DEFAULTFONTFGB, DEFAULTFONTFGA, + DEFAULTFONTBGR, DEFAULTFONTBGG, DEFAULTFONTBGB, DEFAULTFONTBGA, txt); +#endif + +#if defined (_WIN32) && !defined (_XBOX) && defined (_MSC_VER) + OutputDebugStringA(txt); +#endif + + len = strlen(txt); + +#ifdef LOGMESSAGES + if (logstream) + { + size_t d = fwrite(txt, len, 1, logstream); + fflush(logstream); + (void)d; + } +#endif + +#if defined (_WIN32) && !defined (_XBOX) && !defined(_WIN32_WCE) +#ifdef DEBUGFILE + if (debugfile != stderr) +#endif + { + HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE); + DWORD bytesWritten; + + 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)len, &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)len, &bytesWritten, NULL); + } +#else +#ifdef HAVE_TERMIOS + if (consolevent) + { + tty_Hide(); + } +#endif + + if (!framebuffer) + fprintf(stderr, "%s", txt); +#ifdef HAVE_TERMIOS + if (consolevent) + { + tty_Show(); + } +#endif + + // 2004-03-03 AJR Since not all messages end in newline, some were getting displayed late. + if (!framebuffer) + fflush(stderr); + +#endif +} + +// +// I_GetKey +// +INT32 I_GetKey (void) +{ + // Warning: I_GetKey empties the event queue till next keypress + event_t *ev; + INT32 rc = 0; + + // return the first keypress from the event queue + for (; eventtail != eventhead; eventtail = (eventtail+1)&(MAXEVENTS-1)) + { + ev = &events[eventtail]; + if (ev->type == ev_keydown || ev->type == ev_console) + { + rc = ev->data1; + continue; + } + } + + return rc; +} + +// +// I_JoyScale +// +void I_JoyScale(void) +{ +#ifdef GP2X + if (JoyInfo.dev && SDL_JoystickIndex(JoyInfo.dev) == 0) + Joystick.bGamepadStyle = true; + else +#endif + Joystick.bGamepadStyle = cv_joyscale.value==0; + JoyInfo.scale = Joystick.bGamepadStyle?1:cv_joyscale.value; +} + +void I_JoyScale2(void) +{ +#ifdef GP2X + if (JoyInfo2.dev && SDL_JoystickIndex(JoyInfo2.dev) == 0) + Joystick.bGamepadStyle = true; + else +#endif + Joystick2.bGamepadStyle = cv_joyscale2.value==0; + JoyInfo2.scale = Joystick2.bGamepadStyle?1:cv_joyscale2.value; +} + +/** \brief Joystick 1 buttons states +*/ +static UINT64 lastjoybuttons = 0; + +/** \brief Joystick 1 hats state +*/ +static UINT64 lastjoyhats = 0; + +/** \brief Shuts down joystick 1 + + + \return void + + +*/ +static void I_ShutdownJoystick(void) +{ + INT32 i; + event_t event; + event.type=ev_keyup; + event.data2 = 0; + event.data3 = 0; + + lastjoybuttons = lastjoyhats = 0; + + // emulate the up of all joystick buttons + for (i=0;i= 0; i--) + { + joybuttons <<= 1; + if (SDL_JoystickGetButton(JoyInfo.dev,i)) + joybuttons |= 1; + } + + if (joybuttons != lastjoybuttons) + { + INT64 j = 1; // keep only bits that changed since last time + INT64 newbuttons = joybuttons ^ lastjoybuttons; + lastjoybuttons = joybuttons; + + for (i = 0; i < JOYBUTTONS; i++, j <<= 1) + { + if (newbuttons & j) // button changed state? + { + if (joybuttons & j) + event.type = ev_keydown; + else + event.type = ev_keyup; +#ifdef _PSP + if (i == 12) + event.data1 = KEY_ESCAPE; + else +#endif + event.data1 = KEY_JOY1 + i; + D_PostEvent(&event); + } + } + } +#endif + + for (i = JoyInfo.hats - 1; i >= 0; i--) + { + Uint8 hat = SDL_JoystickGetHat(JoyInfo.dev, i); + + if (hat & SDL_HAT_UP ) joyhats|=(UINT64)0x1<<(0 + 4*i); + if (hat & SDL_HAT_DOWN ) joyhats|=(UINT64)0x1<<(1 + 4*i); + if (hat & SDL_HAT_LEFT ) joyhats|=(UINT64)0x1<<(2 + 4*i); + if (hat & SDL_HAT_RIGHT) joyhats|=(UINT64)0x1<<(3 + 4*i); + } + + if (joyhats != lastjoyhats) + { + INT64 j = 1; // keep only bits that changed since last time + INT64 newhats = joyhats ^ lastjoyhats; + lastjoyhats = joyhats; + + for (i = 0; i < JOYHATS*4; i++, j <<= 1) + { + if (newhats & j) // hat changed state? + { + if (joyhats & j) + event.type = ev_keydown; + else + event.type = ev_keyup; + event.data1 = KEY_HAT1 + i; + D_PostEvent(&event); + } + } + } + +#if 0 + // send joystick axis positions + event.type = ev_joystick; + + for (i = JOYAXISSET - 1; i >= 0; i--) + { + event.data1 = i; + if (i*2 + 1 <= JoyInfo.axises) + axisx = SDL_JoystickGetAxis(JoyInfo.dev, i*2 + 0); + else axisx = 0; + if (i*2 + 2 <= JoyInfo.axises) + axisy = SDL_JoystickGetAxis(JoyInfo.dev, i*2 + 1); + else axisy = 0; + +#ifdef _arch_dreamcast // -128 to 127 + axisx = axisx*8; + axisy = axisy*8; +#else // -32768 to 32767 + axisx = axisx/32; + axisy = axisy/32; +#endif + + if (Joystick.bGamepadStyle) + { + // gamepad control type, on or off, live or die + if (axisx < -(JOYAXISRANGE/2)) + event.data2 = -1; + else if (axisx > (JOYAXISRANGE/2)) + event.data2 = 1; + else event.data2 = 0; + if (axisy < -(JOYAXISRANGE/2)) + event.data3 = -1; + else if (axisy > (JOYAXISRANGE/2)) + event.data3 = 1; + else event.data3 = 0; + } + else + { + + axisx = JoyInfo.scale?((axisx/JoyInfo.scale)*JoyInfo.scale):axisx; + axisy = JoyInfo.scale?((axisy/JoyInfo.scale)*JoyInfo.scale):axisy; + +#ifdef SDL_JDEADZONE + if (-SDL_JDEADZONE <= axisx && axisx <= SDL_JDEADZONE) axisx = 0; + if (-SDL_JDEADZONE <= axisy && axisy <= SDL_JDEADZONE) axisy = 0; +#endif + + // analog control style , just send the raw data + event.data2 = axisx; // x axis + event.data3 = axisy; // y axis + } + D_PostEvent(&event); + } +#endif +} + +/** \brief Open joystick handle + + \param fname name of joystick + + \return axises + + +*/ +static int joy_open(const char *fname) +{ + int joyindex = atoi(fname); + int num_joy = 0; + int i; + + if (joystick_started == 0 && joystick2_started == 0) + { + if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1) + { + CONS_Printf(M_GetText("Couldn't initialize joystick: %s\n"), SDL_GetError()); + return -1; + } + else + { + num_joy = SDL_NumJoysticks(); + } + + if (num_joy < joyindex) + { + CONS_Printf(M_GetText("Cannot use joystick #%d/(%s), it doesn't exist\n"),joyindex,fname); + for (i = 0; i < num_joy; i++) + CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickName(i)); + I_ShutdownJoystick(); + return -1; + } + } + else + { + JoyReset(&JoyInfo); + //I_ShutdownJoystick(); + //joy_open(fname); + } + + num_joy = SDL_NumJoysticks(); + + if (joyindex <= 0 || num_joy == 0 || JoyInfo.oldjoy == joyindex) + { +// I_OutputMsg("Unable to use that joystick #(%s), non-number\n",fname); + if (num_joy != 0) + { + CONS_Printf(M_GetText("Found %d joysticks on this system\n"), num_joy); + for (i = 0; i < num_joy; i++) + CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickName(i)); + } + else + CONS_Printf("%s", M_GetText("Found no joysticks on this system\n")); + if (joyindex <= 0 || num_joy == 0) return 0; + } + + JoyInfo.dev = SDL_JoystickOpen(joyindex-1); + CONS_Printf(M_GetText("Joystick: %s\n"), SDL_JoystickName(joyindex-1)); + + if (JoyInfo.dev == NULL) + { + CONS_Printf(M_GetText("Couldn't open joystick: %s\n"), SDL_GetError()); + I_ShutdownJoystick(); + return -1; + } + else + { + JoyInfo.axises = SDL_JoystickNumAxes(JoyInfo.dev); + if (JoyInfo.axises > JOYAXISSET*2) + JoyInfo.axises = JOYAXISSET*2; +/* if (joyaxes<2) + { + I_OutputMsg("Not enought axes?\n"); + I_ShutdownJoystick(); + return 0; + }*/ + + JoyInfo.buttons = SDL_JoystickNumButtons(JoyInfo.dev); + if (JoyInfo.buttons > JOYBUTTONS) + JoyInfo.buttons = JOYBUTTONS; + +#ifdef DC + JoyInfo.hats = 0; +#else + JoyInfo.hats = SDL_JoystickNumHats(JoyInfo.dev); + if (JoyInfo.hats > JOYHATS) + JoyInfo.hats = JOYHATS; + + JoyInfo.balls = SDL_JoystickNumBalls(JoyInfo.dev); +#endif + + //Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(SDL_JoystickIndex(JoyInfo.dev)), "pad"); + + return JoyInfo.axises; + } +} + +//Joystick2 + +/** \brief Joystick 2 buttons states +*/ +static UINT64 lastjoy2buttons = 0; + +/** \brief Joystick 2 hats state +*/ +static UINT64 lastjoy2hats = 0; + +/** \brief Shuts down joystick 2 + + + \return void +*/ +static void I_ShutdownJoystick2(void) +{ + INT32 i; + event_t event; + event.type = ev_keyup; + event.data2 = 0; + event.data3 = 0; + + lastjoy2buttons = lastjoy2hats = 0; + + // emulate the up of all joystick buttons + for (i = 0; i < JOYBUTTONS; i++) + { + event.data1 = KEY_2JOY1 + i; + D_PostEvent(&event); + } + + // emulate the up of all joystick hats + for (i = 0; i < JOYHATS*4; i++) + { + event.data1 = KEY_2HAT1 + i; + D_PostEvent(&event); + } + + // reset joystick position + event.type = ev_joystick2; + for (i = 0; i < JOYAXISSET; i++) + { + event.data1 = i; + D_PostEvent(&event); + } + + JoyReset(&JoyInfo2); + if (!joystick_started && !joystick2_started && SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK) + { + SDL_QuitSubSystem(SDL_INIT_JOYSTICK); + if (cv_usejoystick2.value == 0) + { + DEBFILE("I_Joystick2: SDL's Joystick system has been shutdown\n"); + } + } +} + +void I_GetJoystick2Events(void) +{ + static event_t event = {0,0,0,0}; + INT32 i = 0; + UINT64 joyhats = 0; +#if 0 + INT64 joybuttons = 0; + INT32 axisx, axisy; +#endif + + if (!joystick2_started) + return; + + if (!JoyInfo2.dev) //I_ShutdownJoystick2(); + return; + + +#if 0 + //faB: look for as much buttons as g_input code supports, + // we don't use the others + for (i = JoyInfo2.buttons - 1; i >= 0; i--) + { + joybuttons <<= 1; + if (SDL_JoystickGetButton(JoyInfo2.dev,i)) + joybuttons |= 1; + } + + if (joybuttons != lastjoy2buttons) + { + INT64 j = 1; // keep only bits that changed since last time + INT64 newbuttons = joybuttons ^ lastjoy2buttons; + lastjoy2buttons = joybuttons; + + for (i = 0; i < JOYBUTTONS; i++, j <<= 1) + { + if (newbuttons & j) // button changed state? + { + if (joybuttons & j) + event.type = ev_keydown; + else + event.type = ev_keyup; + event.data1 = KEY_2JOY1 + i; + D_PostEvent(&event); + } + } + } +#endif + + for (i = JoyInfo2.hats - 1; i >= 0; i--) + { + Uint8 hat = SDL_JoystickGetHat(JoyInfo2.dev, i); + + if (hat & SDL_HAT_UP ) joyhats|=(UINT64)0x1<<(0 + 4*i); + if (hat & SDL_HAT_DOWN ) joyhats|=(UINT64)0x1<<(1 + 4*i); + if (hat & SDL_HAT_LEFT ) joyhats|=(UINT64)0x1<<(2 + 4*i); + if (hat & SDL_HAT_RIGHT) joyhats|=(UINT64)0x1<<(3 + 4*i); + } + + if (joyhats != lastjoy2hats) + { + INT64 j = 1; // keep only bits that changed since last time + INT64 newhats = joyhats ^ lastjoy2hats; + lastjoy2hats = joyhats; + + for (i = 0; i < JOYHATS*4; i++, j <<= 1) + { + if (newhats & j) // hat changed state? + { + if (joyhats & j) + event.type = ev_keydown; + else + event.type = ev_keyup; + event.data1 = KEY_2HAT1 + i; + D_PostEvent(&event); + } + } + } + +#if 0 + // send joystick axis positions + event.type = ev_joystick2; + + for (i = JOYAXISSET - 1; i >= 0; i--) + { + event.data1 = i; + if (i*2 + 1 <= JoyInfo2.axises) + axisx = SDL_JoystickGetAxis(JoyInfo2.dev, i*2 + 0); + else axisx = 0; + if (i*2 + 2 <= JoyInfo2.axises) + axisy = SDL_JoystickGetAxis(JoyInfo2.dev, i*2 + 1); + else axisy = 0; + +#ifdef _arch_dreamcast // -128 to 127 + axisx = axisx*8; + axisy = axisy*8; +#else // -32768 to 32767 + axisx = axisx/32; + axisy = axisy/32; +#endif + + if (Joystick2.bGamepadStyle) + { + // gamepad control type, on or off, live or die + if (axisx < -(JOYAXISRANGE/2)) + event.data2 = -1; + else if (axisx > (JOYAXISRANGE/2)) + event.data2 = 1; + else + event.data2 = 0; + if (axisy < -(JOYAXISRANGE/2)) + event.data3 = -1; + else if (axisy > (JOYAXISRANGE/2)) + event.data3 = 1; + else + event.data3 = 0; + } + else + { + + axisx = JoyInfo2.scale?((axisx/JoyInfo2.scale)*JoyInfo2.scale):axisx; + axisy = JoyInfo2.scale?((axisy/JoyInfo2.scale)*JoyInfo2.scale):axisy; + +#ifdef SDL_JDEADZONE + if (-SDL_JDEADZONE <= axisx && axisx <= SDL_JDEADZONE) axisx = 0; + if (-SDL_JDEADZONE <= axisy && axisy <= SDL_JDEADZONE) axisy = 0; +#endif + + // analog control style , just send the raw data + event.data2 = axisx; // x axis + event.data3 = axisy; // y axis + } + D_PostEvent(&event); + } +#endif + +} + +/** \brief Open joystick handle + + \param fname name of joystick + + \return axises + + +*/ +static int joy_open2(const char *fname) +{ + int joyindex = atoi(fname); + int num_joy = 0; + int i; + + if (joystick_started == 0 && joystick2_started == 0) + { + if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1) + { + CONS_Printf(M_GetText("Couldn't initialize joystick: %s\n"), SDL_GetError()); + return -1; + } + else + num_joy = SDL_NumJoysticks(); + + if (num_joy < joyindex) + { + CONS_Printf(M_GetText("Cannot use joystick #%d/(%s), it doesn't exist\n"),joyindex,fname); + for (i = 0; i < num_joy; i++) + CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickName(i)); + I_ShutdownJoystick2(); + return -1; + } + } + else + { + JoyReset(&JoyInfo2); + //I_ShutdownJoystick(); + //joy_open(fname); + } + + num_joy = SDL_NumJoysticks(); + + if (joyindex <= 0 || num_joy == 0 || JoyInfo2.oldjoy == joyindex) + { +// I_OutputMsg("Unable to use that joystick #(%s), non-number\n",fname); + if (num_joy != 0) + { + CONS_Printf(M_GetText("Found %d joysticks on this system\n"), num_joy); + for (i = 0; i < num_joy; i++) + CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickName(i)); + } + else + CONS_Printf("%s", M_GetText("Found no joysticks on this system\n")); + if (joyindex <= 0 || num_joy == 0) return 0; + } + + JoyInfo2.dev = SDL_JoystickOpen(joyindex-1); + CONS_Printf(M_GetText("Joystick2: %s\n"), SDL_JoystickName(joyindex-1)); + + if (!JoyInfo2.dev) + { + CONS_Printf(M_GetText("Couldn't open joystick2: %s\n"), SDL_GetError()); + I_ShutdownJoystick2(); + return -1; + } + else + { + JoyInfo2.axises = SDL_JoystickNumAxes(JoyInfo2.dev); + if (JoyInfo2.axises > JOYAXISSET*2) + JoyInfo2.axises = JOYAXISSET*2; +/* if (joyaxes < 2) + { + I_OutputMsg("Not enought axes?\n"); + I_ShutdownJoystick2(); + return 0; + }*/ + + JoyInfo2.buttons = SDL_JoystickNumButtons(JoyInfo2.dev); + if (JoyInfo2.buttons > JOYBUTTONS) + JoyInfo2.buttons = JOYBUTTONS; + +#ifdef DC + JoyInfo2.hats = 0; +#else + JoyInfo2.hats = SDL_JoystickNumHats(JoyInfo2.dev); + if (JoyInfo2.hats > JOYHATS) + JoyInfo2.hats = JOYHATS; + + JoyInfo2.balls = SDL_JoystickNumBalls(JoyInfo2.dev); +#endif + + //Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(SDL_JoystickIndex(JoyInfo2.dev)), "pad"); + + return JoyInfo2.axises; + } +} + +// +// I_InitJoystick +// +void I_InitJoystick(void) +{ + I_ShutdownJoystick(); + if (!strcmp(cv_usejoystick.string, "0") || M_CheckParm("-nojoy")) + return; + if (joy_open(cv_usejoystick.string) != -1) + JoyInfo.oldjoy = atoi(cv_usejoystick.string); + else + { + cv_usejoystick.value = 0; + return; + } + joystick_started = 1; +} + +void I_InitJoystick2(void) +{ + I_ShutdownJoystick2(); + if (!strcmp(cv_usejoystick2.string, "0") || M_CheckParm("-nojoy")) + return; + if (joy_open2(cv_usejoystick2.string) != -1) + JoyInfo2.oldjoy = atoi(cv_usejoystick2.string); + else + { + cv_usejoystick2.value = 0; + return; + } + joystick2_started = 1; +} + +static void I_ShutdownInput(void) +{ + if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK) + { + JoyReset(&JoyInfo); + JoyReset(&JoyInfo2); + SDL_QuitSubSystem(SDL_INIT_JOYSTICK); + } + +} + +INT32 I_NumJoys(void) +{ + INT32 numjoy = 0; + if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0) + { + if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != -1) + numjoy = SDL_NumJoysticks(); + SDL_QuitSubSystem(SDL_INIT_JOYSTICK); + } + else + numjoy = SDL_NumJoysticks(); + return numjoy; +} + +const char *I_GetJoyName(INT32 joyindex) +{ + const char *joyname = "NA"; + joyindex--; //SDL's Joystick System starts at 0, not 1 + if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0) + { + if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != -1) + joyname = SDL_JoystickName(joyindex); + SDL_QuitSubSystem(SDL_INIT_JOYSTICK); + } + else + joyname = SDL_JoystickName(joyindex); + return joyname; +} + +#ifndef NOMUMBLE +#ifdef HAVE_MUMBLE +// 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 { +#ifdef WINMUMBLE + UINT32 uiVersion; + DWORD uiTick; +#else + Uint32 uiVersion; + Uint32 uiTick; +#endif + 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 +#ifdef WINMUMBLE + UINT32 context_len; +#else + Uint32 context_len; +#endif + unsigned char context[256]; // server/team + wchar_t description[2048]; // game description +} *mumble = NULL; +#endif // HAVE_MUMBLE + +static void I_SetupMumble(void) +{ +#ifdef WINMUMBLE + 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); +#elif defined (HAVE_SHM) + int shmfd; + char memname[256]; + + snprintf(memname, 256, "/MumbleLink.%d", getuid()); + shmfd = shm_open(memname, O_RDWR, S_IRUSR | S_IWUSR); + + if(shmfd < 0) + return; + + mumble = mmap(NULL, sizeof(*mumble), PROT_READ | PROT_WRITE, MAP_SHARED, shmfd, 0); + if (mumble == MAP_FAILED) + mumble = NULL; +#endif +} + +void I_UpdateMumble(const mobj_t *mobj, const listener_t listener) +{ +#ifdef HAVE_MUMBLE + double angle; + fixed_t anglef; + + if (!mumble) + return; + + if(mumble->uiVersion != 2) { + wcsncpy(mumble->name, L"SRB2 "VERSIONSTRING, 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); +#else + (void)mobj; + (void)listener; +#endif // HAVE_MUMBLE +} +#undef WINMUMBLE +#endif // NOMUMBLE + +#ifdef HAVE_TERMIOS + +void I_GetMouseEvents(void) +{ + static UINT8 mdata[5]; + static INT32 i = 0,om2b = 0; + INT32 di, j, mlp, button; + event_t event; + const INT32 mswap[8] = {0, 4, 1, 5, 2, 6, 3, 7}; + + if (!mouse2_started) return; + for (mlp = 0; mlp < 20; mlp++) + { + for (; i < 5; i++) + { + di = read(fdmouse2, mdata+i, 1); + if (di == -1) return; + } + if ((mdata[0] & 0xf8) != 0x80) + { + for (j = 1; j < 5; j++) + if ((mdata[j] & 0xf8) == 0x80) + for (i = 0; i < 5-j; i++) // shift + mdata[i] = mdata[i+j]; + if (i < 5) continue; + } + else + { + button = mswap[~mdata[0] & 0x07]; + for (j = 0; j < MOUSEBUTTONS; j++) + { + if (om2b & (1<> 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 UINT8 (logitech mouses) + { + if (buffer[i] & 32) + handlermouse2buttons |= 4; + else + handlermouse2buttons &= ~4; + } + } +} + +void I_GetMouseEvents(void) +{ + static UINT8 lastbuttons2 = 0; //mouse movement + event_t event; + + if (mouse2filehandle == INVALID_HANDLE_VALUE) + return; + + I_PoolMouse2(); + // post key event for buttons + if (handlermouse2buttons != lastbuttons2) + { + INT32 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.data1 = KEY_2MOUSE1+i; + D_PostEvent(&event); + } + } + + if (handlermouse2x != 0 || handlermouse2y != 0) + { + event.type = ev_mouse2; + event.data1 = 0; +// event.data1 = buttons; // not needed + event.data2 = handlermouse2x << 1; + event.data3 = -handlermouse2y << 1; + handlermouse2x = 0; + handlermouse2y = 0; + + D_PostEvent(&event); + } +} +#else +void I_GetMouseEvents(void){}; +#endif + +// +// I_StartupMouse2 +// +void I_StartupMouse2(void) +{ +#ifdef HAVE_TERMIOS + struct termios m2tio; + size_t i; + INT32 dtr = -1, rts = -1;; + I_ShutdownMouse2(); + if (cv_usemouse2.value == 0) return; + if ((fdmouse2 = open(cv_mouse2port.string, O_RDONLY|O_NONBLOCK|O_NOCTTY)) == -1) + { + CONS_Printf(M_GetText("Error opening %s!\n"), cv_mouse2port.string); + return; + } + tcflush(fdmouse2, TCIOFLUSH); + m2tio.c_iflag = IGNBRK; + m2tio.c_oflag = 0; + m2tio.c_cflag = CREAD|CLOCAL|HUPCL|CS8|CSTOPB|B1200; + m2tio.c_lflag = 0; + m2tio.c_cc[VTIME] = 0; + m2tio.c_cc[VMIN] = 1; + tcsetattr(fdmouse2, TCSANOW, &m2tio); + for (i = 0; i < strlen(cv_mouse2opt.string); i++) + { + if (toupper(cv_mouse2opt.string[i]) == 'D') + { + if (cv_mouse2opt.string[i+1] == '-') + dtr = 0; + else + dtr = 1; + } + if (toupper(cv_mouse2opt.string[i]) == 'R') + { + if (cv_mouse2opt.string[i+1] == '-') + rts = 0; + else + rts = 1; + } + if (dtr != -1 || rts != -1) + { + INT32 c; + if (!ioctl(fdmouse2, TIOCMGET, &c)) + { + if (!dtr) + c &= ~TIOCM_DTR; + else if (dtr > 0) + c |= TIOCM_DTR; + } + if (!rts) + c &= ~TIOCM_RTS; + else if (rts > 0) + c |= TIOCM_RTS; + ioctl(fdmouse2, TIOCMSET, &c); + } + } + mouse2_started = 1; + I_AddExitFunc(I_ShutdownMouse2); +#elif defined (_WIN32) && !defined (_XBOX) + DCB dcb; + + if (mouse2filehandle != INVALID_HANDLE_VALUE) + I_ShutdownMouse2(); + + if (cv_usemouse2.value == 0) + 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) + { + INT32 e = GetLastError(); + if (e == 5) + CONS_Alert(CONS_ERROR, M_GetText("Can't open %s: Access denied\n"), cv_mouse2port.string); + else + CONS_Alert(CONS_ERROR, M_GetText("Can't open %s: error %d\n"), cv_mouse2port.string, e); + return; + } + } + + // getevent when somthing happens + //SetCommMask(mouse2filehandle, EV_RXCHAR); + + // 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 = TRUE; + dcb.fParity = TRUE; + + SetCommState(mouse2filehandle, &dcb); + I_AddExitFunc(I_ShutdownMouse2); +#endif +} + +// +// I_Tactile +// +void I_Tactile(FFType pFFType, const JoyFF_t *FFEffect) +{ + // UNUSED. + (void)pFFType; + (void)FFEffect; +} + +void I_Tactile2(FFType pFFType, const JoyFF_t *FFEffect) +{ + // UNUSED. + (void)pFFType; + (void)FFEffect; +} + +/** \brief empty ticcmd for player 1 +*/ +static ticcmd_t emptycmd; + +ticcmd_t *I_BaseTiccmd(void) +{ + return &emptycmd; +} + +/** \brief empty ticcmd for player 2 +*/ +static ticcmd_t emptycmd2; + +ticcmd_t *I_BaseTiccmd2(void) +{ + return &emptycmd2; +} + +#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX) +static HMODULE winmm = NULL; +static DWORD starttickcount = 0; // hack for win2k time bug +static p_timeGetTime pfntimeGetTime = NULL; + +// --------- +// 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 +// --------- + +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 = (INT32)((currtime.QuadPart - basetime.QuadPart) * NEWTICRATE + / frequency.QuadPart); + } + else if (pfntimeGetTime) + { + currtime.LowPart = pfntimeGetTime(); + if (!basetime.LowPart) + basetime.LowPart = currtime.LowPart; + newtics = ((currtime.LowPart - basetime.LowPart)/(1000/NEWTICRATE)); + } + } + else + newtics = (GetTickCount() - starttickcount)/(1000/NEWTICRATE); + + return newtics; +} + +static void I_ShutdownTimer(void) +{ + pfntimeGetTime = NULL; + if (winmm) + { + p_timeEndPeriod pfntimeEndPeriod = (p_timeEndPeriod)GetProcAddress(winmm, "timeEndPeriod"); + if (pfntimeEndPeriod) + pfntimeEndPeriod(1); + FreeLibrary(winmm); + winmm = NULL; + } +} +#else +// +// I_GetTime +// returns time in 1/TICRATE second tics +// +tic_t I_GetTime (void) +{ +#ifdef _arch_dreamcast + static Uint64 basetime = 0; + Uint64 ticks = timer_ms_gettime64(); //using timer_ms_gettime64 instand of SDL_GetTicks for the Dreamcast +#else + static Uint32 basetime = 0; + Uint32 ticks = SDL_GetTicks(); +#endif + + if (!basetime) + basetime = ticks; + + ticks -= basetime; + + ticks = (ticks*TICRATE); + +#if 0 //#ifdef _WIN32_WCE + ticks = (ticks/10); +#else + ticks = (ticks/1000); +#endif + + return (tic_t)ticks; +} +#endif + +// +//I_StartupTimer +// +void I_StartupTimer(void) +{ +#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX) + // for win2k time bug + if (M_CheckParm("-gettickcount")) + { + starttickcount = GetTickCount(); + CONS_Printf("%s", M_GetText("Using GetTickCount()\n")); + } + winmm = LoadLibraryA("winmm.dll"); + if (winmm) + { + p_timeEndPeriod pfntimeBeginPeriod = (p_timeEndPeriod)GetProcAddress(winmm, "timeBeginPeriod"); + if (pfntimeBeginPeriod) + pfntimeBeginPeriod(1); + pfntimeGetTime = (p_timeGetTime)GetProcAddress(winmm, "timeGetTime"); + } + I_AddExitFunc(I_ShutdownTimer); +#elif 0 //#elif !defined (_arch_dreamcast) && !defined(GP2X) // the DC have it own timer and GP2X have broken pthreads? + if (SDL_InitSubSystem(SDL_INIT_TIMER) < 0) + I_Error("SRB2: Needs SDL_Timer, Error: %s", SDL_GetError()); +#endif +} + + + +void I_Sleep(void) +{ +#if !(defined (_arch_dreamcast) || defined (_XBOX)) + if (cv_sleep.value != -1) + SDL_Delay(cv_sleep.value); +#endif +} + +INT32 I_StartupSystem(void) +{ + SDL_version SDLcompiled; + const SDL_version *SDLlinked; +#ifdef _XBOX +#ifdef __GNUC__ + char DP[] =" Sonic Robo Blast 2!\n"; + debugPrint(DP); +#endif + unlink("e:/Games/SRB2/stdout.txt"); + freopen("e:/Games/SRB2/stdout.txt", "w+", stdout); + unlink("e:/Games/SRB2/stderr.txt"); + freopen("e:/Games/SRB2/stderr.txt", "w+", stderr); +#endif +#ifdef _arch_dreamcast +#ifdef _DEBUG + //gdb_init(); +#endif + printf(__FILE__":%i\n",__LINE__); +#ifdef _DEBUG + //gdb_breakpoint(); +#endif +#endif + SDL_VERSION(&SDLcompiled) + SDLlinked = SDL_Linked_Version(); + I_StartupConsole(); + I_OutputMsg("Compiled for SDL version: %d.%d.%d\n", + SDLcompiled.major, SDLcompiled.minor, SDLcompiled.patch); + I_OutputMsg("Linked with SDL version: %d.%d.%d\n", + SDLlinked->major, SDLlinked->minor, SDLlinked->patch); +#if 0 //#ifdef GP2X //start up everything + if (SDL_Init(SDL_INIT_NOPARACHUTE|SDL_INIT_EVERYTHING) < 0) +#else + if (SDL_Init(SDL_INIT_NOPARACHUTE) < 0) +#endif + I_Error("SRB2: SDL System Error: %s", SDL_GetError()); //Alam: Oh no.... +#ifndef NOMUMBLE + I_SetupMumble(); +#endif + return 0; +} + + +// +// I_Quit +// +void I_Quit(void) +{ + static SDL_bool quiting = SDL_FALSE; + + /* prevent recursive I_Quit() */ + if (quiting) goto death; + SDLforceUngrabMouse(); + quiting = SDL_FALSE; + I_ShutdownConsole(); + M_SaveConfig(NULL); //save game config, cvars.. +#ifndef NONET + D_SaveBan(); // save the ban list +#endif + G_SaveGameData(); // Tails 12-08-2002 + //added:16-02-98: when recording a demo, should exit using 'q' key, + // but sometimes we forget and use 'F10'.. so save here too. + + if (demorecording) + G_CheckDemoStatus(); + if (metalrecording) + G_StopMetalRecording(); + + D_QuitNetGame(); + I_ShutdownMusic(); + I_ShutdownSound(); + I_ShutdownCD(); + // use this for 1.28 19990220 by Kin + I_ShutdownGraphics(); + I_ShutdownInput(); + I_ShutdownSystem(); +#ifndef _arch_dreamcast + SDL_Quit(); +#endif + /* if option -noendtxt is set, don't print the text */ + if (!M_CheckParm("-noendtxt") && W_CheckNumForName("ENDOOM") != LUMPERROR) + { + printf("\r"); + ShowEndTxt(); + } +death: + W_Shutdown(); +#ifdef GP2X + chdir("/usr/gp2x"); + execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL); +#endif + exit(0); +} + +void I_WaitVBL(INT32 count) +{ + count = 1; + SDL_Delay(count); +} + +void I_BeginRead(void) +{ +} + +void I_EndRead(void) +{ +} + +// +// I_Error +// +/** \brief phuck recursive errors +*/ +static INT32 errorcount = 0; + +/** \brief recursive error detecting +*/ +static boolean shutdowning = false; + +void I_Error(const char *error, ...) +{ + va_list argptr; +#if (defined (MAC_ALERT) || defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX) + char buffer[8192]; +#endif + + // recursive error detecting + if (shutdowning) + { + errorcount++; + if (errorcount == 1) + SDLforceUngrabMouse(); + // try to shutdown each subsystem separately + if (errorcount == 2) + I_ShutdownMusic(); + if (errorcount == 3) + I_ShutdownSound(); + if (errorcount == 4) + I_ShutdownCD(); + if (errorcount == 5) + I_ShutdownGraphics(); + if (errorcount == 6) + I_ShutdownInput(); + if (errorcount == 7) + I_ShutdownSystem(); +#ifndef _arch_dreamcast + if (errorcount == 8) + SDL_Quit(); +#endif + if (errorcount == 9) + { + M_SaveConfig(NULL); + G_SaveGameData(); + } + if (errorcount > 20) + { +#ifdef MAC_ALERT + va_start(argptr, error); + vsprintf(buffer, error, argptr); + va_end(argptr); + // 2004-03-03 AJR Since the Mac user is most likely double clicking to run the game, give them a panel. + MacShowAlert("Recursive Error", buffer, "Quit", NULL, NULL); +#elif (defined (_WIN32) || (defined (_WIN32_WCE)) && !defined (__GNUC__)) && !defined (_XBOX) + va_start(argptr,error); + vsprintf(buffer, error, argptr); + va_end(argptr); +#ifndef _WIN32_WCE + { + HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE); + DWORD bytesWritten; + if (co != INVALID_HANDLE_VALUE) + { + if (GetFileType(co) == FILE_TYPE_CHAR && GetConsoleMode(co, &bytesWritten)) + WriteConsoleA(co, buffer, (DWORD)strlen(buffer), NULL, NULL); + else + WriteFile(co, buffer, (DWORD)strlen(buffer), &bytesWritten, NULL); + } + } +#endif + OutputDebugStringA(buffer); + MessageBoxA(vid.WndParent, buffer, "SRB2 Recursive Error", MB_OK|MB_ICONERROR); +#else + // Don't print garbage + va_start(argptr, error); + if (!framebuffer) + vfprintf (stderr, error, argptr); + va_end(argptr); +#endif + W_Shutdown(); +#ifdef GP2X + chdir("/usr/gp2x"); + execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL); +#endif + exit(-1); // recursive errors detected + } + } + shutdowning = true; + I_ShutdownConsole(); +#ifndef MAC_ALERT + // Message first. + va_start(argptr,error); + if (!framebuffer) + { + fprintf(stderr, "Error: "); + vfprintf(stderr,error,argptr); + fprintf(stderr, "\n"); + } + va_end(argptr); + + if (!framebuffer) + fflush(stderr); +#endif + M_SaveConfig(NULL); // save game config, cvars.. +#ifndef NONET + D_SaveBan(); // save the ban list +#endif + G_SaveGameData(); // Tails 12-08-2002 + + // Shutdown. Here might be other errors. + if (demorecording) + G_CheckDemoStatus(); + if (metalrecording) + G_StopMetalRecording(); + + D_QuitNetGame(); + I_ShutdownMusic(); + I_ShutdownSound(); + I_ShutdownCD(); + // use this for 1.28 19990220 by Kin + I_ShutdownGraphics(); + I_ShutdownInput(); + I_ShutdownSystem(); +#ifndef _arch_dreamcast + SDL_Quit(); +#endif +#ifdef MAC_ALERT + va_start(argptr, error); + vsprintf(buffer, error, argptr); + va_end(argptr); + // 2004-03-03 AJR Since the Mac user is most likely double clicking to run the game, give them a panel. + MacShowAlert("Critical Error", buffer, "Quit", NULL, NULL); +#endif + W_Shutdown(); +#if defined (PARANOIA) && defined (__CYGWIN__) + *(INT32 *)2 = 4; //Alam: Debug! +#endif +#ifdef GP2X + chdir("/usr/gp2x"); + execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL); +#endif + exit(-1); +} + +/** \brief quit function table +*/ +static quitfuncptr quit_funcs[MAX_QUIT_FUNCS]; /* initialized to all bits 0 */ + +// +// Adds a function to the list that need to be called by I_SystemShutdown(). +// +void I_AddExitFunc(void (*func)()) +{ + INT32 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)()) +{ + INT32 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; + } + } +} + +// +// Closes down everything. This includes restoring the initial +// palette and video mode, and removing whatever mouse, keyboard, and +// timer routines have been installed. +// +// NOTE: Shutdown user funcs are effectively called in reverse order. +// +void I_ShutdownSystem(void) +{ + INT32 c; + + for (c = MAX_QUIT_FUNCS-1; c >= 0; c--) + if (quit_funcs[c]) + (*quit_funcs[c])(); +#ifdef LOGMESSAGES + if (logstream) + { + fclose(logstream); + logstream = NULL; + } +#endif + +} + +void I_GetDiskFreeSpace(INT64 *freespace) +{ +#if defined (_arch_dreamcast) || defined (_PSP) + *freespace = 0; +#elif defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) +#if defined (SOLARIS) || defined (__HAIKU__) || defined (_WII) || defined (_PS3) + *freespace = INT32_MAX; + return; +#else // Both Linux and BSD have this, apparently. + struct statfs stfs; + if (statfs(".", &stfs) == -1) + { + *freespace = INT32_MAX; + return; + } + *freespace = stfs.f_bavail * stfs.f_bsize; +#endif +#elif (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX) + static p_GetDiskFreeSpaceExA pfnGetDiskFreeSpaceEx = NULL; + static boolean testwin95 = false; + ULARGE_INTEGER usedbytes, lfreespace; + + if (!testwin95) + { + pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)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; + } +#else // Dummy for platform independent; 1GB should be enough + *freespace = 1024*1024*1024; +#endif +} + +char *I_GetUserName(void) +{ +#ifdef GP2X + static char username[MAXPLAYERNAME] = "GP2XUSER"; + return username; +#elif defined (PSP) + static char username[MAXPLAYERNAME] = "PSPUSER"; + return username; +#elif !(defined (_WIN32_WCE) || defined (_XBOX)) + static char username[MAXPLAYERNAME]; + char *p; +#ifdef _WIN32 + DWORD i = MAXPLAYERNAME; + + if (!GetUserNameA(username, &i)) +#endif + { + p = I_GetEnv("USER"); + if (!p) + { + p = I_GetEnv("user"); + if (!p) + { + p = I_GetEnv("USERNAME"); + if (!p) + { + p = I_GetEnv("username"); + if (!p) + { + return NULL; + } + } + } + } + strncpy(username, p, MAXPLAYERNAME); + } + + + if (strcmp(username, "") != 0) + return username; +#endif + return NULL; // dummy for platform independent version +} + +INT32 I_mkdir(const char *dirname, INT32 unixright) +{ +//[segabor] +#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) || defined (__CYGWIN__) || defined (__OS2__) + return mkdir(dirname, unixright); +#elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX) + UNREFERENCED_PARAMETER(unixright); /// \todo should implement ntright under nt... + return CreateDirectoryA(dirname, NULL); +#else + (void)dirname; + (void)unixright; + return false; +#endif +} + +char *I_GetEnv(const char *name) +{ +#ifdef NEED_SDL_GETENV + return SDL_getenv(name); +#elif defined(_WIN32_WCE) + (void)name; + return NULL; +#else + return getenv(name); +#endif +} + +INT32 I_PutEnv(char *variable) +{ +#ifdef NEED_SDL_GETENV + return SDL_putenv(variable); +#elif defined(_WIN32_WCE) + return ((variable)?-1:0); +#else + return putenv(variable); +#endif +} + +/** \brief The isWadPathOk function + + \param path string path to check + + \return if true, wad file found + + +*/ +static boolean isWadPathOk(const char *path) +{ + char *wad3path = malloc(256); + + if (!wad3path) + return false; + + sprintf(wad3path, pandf, path, WADKEYWORD1); + + if (FIL_ReadFileOK(wad3path)) + { + free(wad3path); + return true; + } + + sprintf(wad3path, pandf, path, WADKEYWORD2); + + if (FIL_ReadFileOK(wad3path)) + { + free(wad3path); + return true; + } + + free(wad3path); + return false; +} + +static void pathonly(char *s) +{ + size_t j; + + for (j = strlen(s); j != (size_t)-1; j--) + if ((s[j] == '\\') || (s[j] == ':') || (s[j] == '/')) + { + if (s[j] == ':') s[j+1] = 0; + else s[j] = 0; + return; + } +} + +/** \brief search for srb2.srb in the given path + + \param searchDir starting path + + \return WAD path if not NULL + + +*/ +static const char *searchWad(const char *searchDir) +{ + static char tempsw[256] = ""; + filestatus_t fstemp; + + strcpy(tempsw, WADKEYWORD1); + fstemp = filesearch(tempsw,searchDir,NULL,true,20); + if (fstemp == FS_FOUND) + { + pathonly(tempsw); + return tempsw; + } + + strcpy(tempsw, WADKEYWORD2); + fstemp = filesearch(tempsw, searchDir, NULL, true, 20); + if (fstemp == FS_FOUND) + { + pathonly(tempsw); + return tempsw; + } + return NULL; +} + +/** \brief go through all possible paths and look for srb2.srb + + \return path to srb2.srb if any +*/ +static const char *locateWad(void) +{ + const char *envstr; + const char *WadPath; + + I_OutputMsg("SRB2WADDIR"); + // does SRB2WADDIR exist? + if (((envstr = I_GetEnv("SRB2WADDIR")) != NULL) && isWadPathOk(envstr)) + return envstr; + +#if defined(_WIN32_WCE) || defined(_PS3) || defined(_PSP) + // examine argv[0] + strcpy(returnWadPath, myargv[0]); + pathonly(returnWadPath); + I_PutEnv(va("HOME=%s",returnWadPath)); + if (isWadPathOk(returnWadPath)) + return returnWadPath; +#endif + +#ifndef NOCWD + I_OutputMsg(",."); + // examine current dir + strcpy(returnWadPath, "."); + if (isWadPathOk(returnWadPath)) + return NULL; +#endif + + // examine default dirs +#ifdef DEFAULTWADLOCATION1 + I_OutputMsg(","DEFAULTWADLOCATION1); + strcpy(returnWadPath, DEFAULTWADLOCATION1); + if (isWadPathOk(returnWadPath)) + return returnWadPath; +#endif +#ifdef DEFAULTWADLOCATION2 + I_OutputMsg(","DEFAULTWADLOCATION2); + strcpy(returnWadPath, DEFAULTWADLOCATION2); + if (isWadPathOk(returnWadPath)) + return returnWadPath; +#endif +#ifdef DEFAULTWADLOCATION3 + I_OutputMsg(","DEFAULTWADLOCATION3); + strcpy(returnWadPath, DEFAULTWADLOCATION3); + if (isWadPathOk(returnWadPath)) + return returnWadPath; +#endif +#ifdef DEFAULTWADLOCATION4 + I_OutputMsg(","DEFAULTWADLOCATION4); + strcpy(returnWadPath, DEFAULTWADLOCATION4); + if (isWadPathOk(returnWadPath)) + return returnWadPath; +#endif +#ifdef DEFAULTWADLOCATION5 + I_OutputMsg(","DEFAULTWADLOCATION5); + strcpy(returnWadPath, DEFAULTWADLOCATION5); + if (isWadPathOk(returnWadPath)) + return returnWadPath; +#endif +#ifdef DEFAULTWADLOCATION6 + I_OutputMsg(","DEFAULTWADLOCATION6); + strcpy(returnWadPath, DEFAULTWADLOCATION6); + if (isWadPathOk(returnWadPath)) + return returnWadPath; +#endif +#ifdef DEFAULTWADLOCATION7 + I_OutputMsg(","DEFAULTWADLOCATION7); + strcpy(returnWadPath, DEFAULTWADLOCATION7); + if (isWadPathOk(returnWadPath)) + return returnWadPath; +#endif +#ifndef NOHOME + // find in $HOME + I_OutputMsg(",HOME"); + if ((envstr = I_GetEnv("HOME")) != NULL) + { + WadPath = searchWad(envstr); + if (WadPath) + return WadPath; + } +#endif +#ifdef DEFAULTSEARCHPATH1 + // find in /usr/local + I_OutputMsg(", in:"DEFAULTSEARCHPATH1); + WadPath = searchWad(DEFAULTSEARCHPATH1); + if (WadPath) + return WadPath; +#endif +#ifdef DEFAULTSEARCHPATH2 + // find in /usr/games + I_OutputMsg(", in:"DEFAULTSEARCHPATH2); + WadPath = searchWad(DEFAULTSEARCHPATH2); + if (WadPath) + return WadPath; +#endif +#ifdef DEFAULTSEARCHPATH3 + // find in ??? + I_OutputMsg(", in:"DEFAULTSEARCHPATH3); + WadPath = searchWad(DEFAULTSEARCHPATH3); + if (WadPath) + return WadPath; +#endif + // if nothing was found + return NULL; +} + +const char *I_LocateWad(void) +{ + const char *waddir; + + I_OutputMsg("Looking for WADs in: "); + waddir = locateWad(); + I_OutputMsg("\n"); + + if (waddir) + { + // change to the directory where we found srb2.srb +#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX) + SetCurrentDirectoryA(waddir); +#elif !defined (_WIN32_WCE) && !defined (_PS3) + if (chdir(waddir) == -1) + I_OutputMsg("Couldn't change working directory\n"); +#endif + } + return waddir; +} + +#ifdef LINUX +#define MEMINFO_FILE "/proc/meminfo" +#define MEMTOTAL "MemTotal:" +#define MEMFREE "MemFree:" +#endif + +// quick fix for compil +UINT32 I_GetFreeMem(UINT32 *total) +{ +#if defined (_arch_dreamcast) + //Dreamcast! + if (total) + *total = 16<<20; + return 8<<20; +#elif defined (_PSP) + // PSP + if (total) + *total = 32<<20; + return 16<<20; +#elif defined (FREEBSD) + struct vmmeter sum; + kvm_t *kd; + struct nlist namelist[] = + { +#define X_SUM 0 + {"_cnt"}, + {NULL} + }; + if ((kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "kvm_open")) == NULL) + { + *total = 0L; + return 0; + } + if (kvm_nlist(kd, namelist) != 0) + { + kvm_close (kd); + *total = 0L; + return 0; + } + if (kvm_read(kd, namelist[X_SUM].n_value, &sum, + sizeof (sum)) != sizeof (sum)) + { + kvm_close(kd); + *total = 0L; + return 0; + } + kvm_close(kd); + + if (total) + *total = sum.v_page_count * sum.v_page_size; + return sum.v_free_count * sum.v_page_size; +#elif defined (SOLARIS) + /* Just guess */ + if (total) + *total = 32 << 20; + return 32 << 20; +#elif defined (LINUX) + /* Linux */ + char buf[1024]; + char *memTag; + UINT32 freeKBytes; + UINT32 totalKBytes; + INT32 n; + INT32 meminfo_fd = -1; + + meminfo_fd = open(MEMINFO_FILE, O_RDONLY); + n = read(meminfo_fd, buf, 1023); + close(meminfo_fd); + + if (n < 0) + { + // Error + *total = 0L; + return 0; + } + + buf[n] = '\0'; + if (NULL == (memTag = strstr(buf, MEMTOTAL))) + { + // Error + *total = 0L; + return 0; + } + + memTag += sizeof (MEMTOTAL); + totalKBytes = atoi(memTag); + + if (NULL == (memTag = strstr(buf, MEMFREE))) + { + // Error + *total = 0L; + return 0; + } + + memTag += sizeof (MEMFREE); + freeKBytes = atoi(memTag); + + if (total) + *total = totalKBytes << 10; + return freeKBytes << 10; +#elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX) + MEMORYSTATUS info; + + info.dwLength = sizeof (MEMORYSTATUS); + GlobalMemoryStatus( &info ); + if (total) + *total = (UINT32)info.dwTotalPhys; + return (UINT32)info.dwAvailPhys; +#elif defined (__OS2__) + UINT32 pr_arena; + + if (total) + DosQuerySysInfo( QSV_TOTPHYSMEM, QSV_TOTPHYSMEM, + (PVOID) total, sizeof (UINT32)); + DosQuerySysInfo( QSV_MAXPRMEM, QSV_MAXPRMEM, + (PVOID) &pr_arena, sizeof (UINT32)); + + return pr_arena; +#else + // Guess 48 MB. + if (total) + *total = 48<<20; + return 48<<20; +#endif /* LINUX */ +} + +const CPUInfoFlags *I_CPUInfo(void) +{ +#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX) + static CPUInfoFlags WIN_CPUInfo; + SYSTEM_INFO SI; + p_IsProcessorFeaturePresent pfnCPUID = (p_IsProcessorFeaturePresent)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 + } +#ifdef HAVE_SDLCPUINFO + else + { + WIN_CPUInfo.RDTSC = SDL_HasRDTSC(); + WIN_CPUInfo.MMX = SDL_HasMMX(); + WIN_CPUInfo.AMD3DNow = SDL_Has3DNow(); + WIN_CPUInfo.SSE = SDL_HasSSE(); + WIN_CPUInfo.SSE2 = SDL_HasSSE2(); + WIN_CPUInfo.AltiVec = SDL_HasAltiVec(); + } + WIN_CPUInfo.MMXExt = SDL_HasMMXExt(); + WIN_CPUInfo.AMD3DNowExt = SDL_Has3DNowExt(); +#endif + 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; +#elif defined (HAVE_SDLCPUINFO) + static CPUInfoFlags SDL_CPUInfo; + memset(&SDL_CPUInfo,0,sizeof (CPUInfoFlags)); + SDL_CPUInfo.RDTSC = SDL_HasRDTSC(); + SDL_CPUInfo.MMX = SDL_HasMMX(); + SDL_CPUInfo.MMXExt = SDL_HasMMXExt(); + SDL_CPUInfo.AMD3DNow = SDL_Has3DNow(); + SDL_CPUInfo.AMD3DNowExt = SDL_Has3DNowExt(); + SDL_CPUInfo.SSE = SDL_HasSSE(); + SDL_CPUInfo.SSE2 = SDL_HasSSE2(); + SDL_CPUInfo.AltiVec = SDL_HasAltiVec(); + return &SDL_CPUInfo; +#else + return NULL; /// \todo CPUID asm +#endif +} + +#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX) +static void CPUAffinity_OnChange(void); +static consvar_t cv_cpuaffinity = {"cpuaffinity", "-1", CV_SAVE | CV_CALL, NULL, CPUAffinity_OnChange, 0, NULL, NULL, 0, 0, NULL}; + +static p_GetCurrentProcess pfnGetCurrentProcess = NULL; +static p_GetProcessAffinityMask pfnGetProcessAffinityMask = NULL; +static p_SetProcessAffinityMask pfnSetProcessAffinityMask = NULL; + +static inline VOID GetAffinityFuncs(VOID) +{ + HMODULE h = GetModuleHandleA("kernel32.dll"); + pfnGetCurrentProcess = (p_GetCurrentProcess)GetProcAddress(h, "GetCurrentProcess"); + pfnGetProcessAffinityMask = (p_GetProcessAffinityMask)GetProcAddress(h, "GetProcessAffinityMask"); + pfnSetProcessAffinityMask = (p_SetProcessAffinityMask)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, (INT32)(dwSysMask & cv_cpuaffinity.value)); + } + else + CV_StealthSetValue(&cv_cpuaffinity, (INT32)dwProcMask); +} +#endif + +void I_RegisterSysCommands(void) +{ +#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX) + GetAffinityFuncs(); + CV_RegisterVar(&cv_cpuaffinity); +#endif +} +#endif diff --git a/src/sdl12/i_ttf.c b/src/sdl12/i_ttf.c new file mode 100644 index 000000000..770a81d98 --- /dev/null +++ b/src/sdl12/i_ttf.c @@ -0,0 +1,340 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright (C) 2011 by Callum Dickinson. +// +// 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 SDL_ttf interface code. Necessary for platforms with no framebuffer console systems. + +#if defined(SDL) && defined(HAVE_TTF) +#include "SDL.h" +#include "SDL_ttf.h" +#include "../doomdef.h" +#include "../doomstat.h" +#include "../d_netfil.h" +#include "../filesrch.h" +#include "i_ttf.h" + +// Search directories to find aforementioned TTF file. +#ifdef _PS3 +#include +#define FONTSEARCHPATH1 "/dev_hdd0/game/SRB2-PS3_/USRDIR/etc" +#elif defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) +#define FONTSEARCHPATH1 "/usr/share/fonts" +#define FONTSEARCHPATH2 "/usr/local/share/fonts" +#define FONTSEARCHPATH3 "/usr/games/SRB2" +#define FONTSEARCHPATH4 "/usr/local/games/SRB2" +#define FONTSEARCHPATH5 "/usr/local/share/games/SRB2" +#else +#define FONTSEARCHPATH1 "." +#endif + +#define FONTHANDLE -1 + +// Renduring surfaces. +SDL_Surface *TTFSurface = NULL; +SDL_Surface *TTFRendSurface = NULL; +// Text box. +SDL_Rect TTFRect; +// Temporary storage for the new TTFRect, used to check for +// line wrapping. +SDL_Rect TTFRectCheck; +// Text rendering resolution. +videoResolution res; +// Text storage buffer, the contents get printed to the SDL surface. +char textbuffer[8192]; + +// look for default ttf file in given directory +static char *searchFont(const char *fontsearchDir) +{ + static char tempsw[256] = ""; + filestatus_t fstemp; + + strcpy(tempsw, FONTFILE); + fstemp = filesearch(tempsw, fontsearchDir, NULL, true, 20); + if (fstemp == FS_FOUND) + { + return tempsw; + } + return NULL; +} + +// Load TTF font from file. +INT32 I_TTFLoadFont(const char *file, UINT32 ptsize) +{ + TTF_Font *tmpfont = NULL; + float fontsize; + + // If a font is currently loaded, unload it. + if (currentfont) + { + TTF_CloseFont(currentfont); + } + + // Scale the specified font point size for the current resolution. + fontsize = (ptsize * 0.005f) * (res.width - res.height); + + tmpfont = TTF_OpenFont(file, fontsize); + + if (!tmpfont) + return FONTHANDLE; + + // set pointer for current font + currentfont = tmpfont; + + // set current font point size + currentfontpoint = ptsize; + + // get font properties, and set them + currentfontstyle = TTF_GetFontStyle(currentfont); + TTF_SetFontStyle(currentfont, currentfontstyle); + + // these functions only exist in SDL_ttf 2.0.10 onwards +#if SDL_TTF_VERSION_ATLEAST(2,0,10) + currentfontkerning = TTF_GetFontKerning(currentfont); + TTF_SetFontKerning(currentfont, currentfontkerning); + + currentfonthinting = TTF_GetFontHinting(currentfont); + TTF_SetFontHinting(currentfont, currentfonthinting); + + currentfontoutline = TTF_GetFontOutline(currentfont); + TTF_SetFontOutline(currentfont, currentfontoutline); +#endif + + return 0; +} + +static void I_TTFRendSurface(const char *textmsg, TTF_Font *font, TextQuality quality, SDL_Color fontfgcolor, SDL_Color fontbgcolor) +{ + // Print text in the buffer. + // SDL_ttf has three modes to draw text. + // Solid rendering is quick, but dirty. Use it if you need speed more than quality. + switch (quality) + { + case solid: + TTFRendSurface = TTF_RenderText_Solid(font, textmsg, fontfgcolor); + break; + // Shaded rendering adds a background to the rendered text. Because of this, I_TTFDrawText + // takes an extra color more than the other styles to be a background color. + // Shaded is supposedly as fast as solid rendering and about as good quality as blended. + case shaded: + TTFRendSurface = TTF_RenderText_Shaded(font, textmsg, fontfgcolor, fontbgcolor); + break; + // Blended rendering is the opposite of solid. Good quality, but slow. + case blended: + TTFRendSurface = TTF_RenderText_Blended(font, textmsg, fontfgcolor); + break; + } + + // Get SDL to update the main surface. + SDL_BlitSurface(TTFRendSurface, NULL, TTFSurface, &TTFRect); + SDL_Flip(TTFSurface); +} + +// Draw text to screen. It will accept four colour vales (red, green, blue and alpha) +// with foreground for draw modes Solid and Blended, and an extra four values for background +// colour with draw type Shaded. +void I_TTFDrawText(TTF_Font *font, TextQuality quality, INT32 fgR, INT32 fgG, INT32 fgB, INT32 fgA, INT32 bgR, INT32 bgG, INT32 bgB, INT32 bgA, const char *textmsg) +{ + // Temporary small buffer to store character to process. + // NULL pointer to prevc to kill warning + char c, prevc = 0x0; + // hack to allow TTF_SizeText to work properly. + char linebuffer[2]; + // Don't need h, but TTF_SizeText needs a height parameter + INT32 w, h; + + // Globally declare foreground and background text colours, + // text drawing mode and the font to draw. + SDL_Color fontfgcolor = {fgR, fgG, fgB, fgA}; + SDL_Color fontbgcolor = {bgR, bgG, bgB, bgA}; + + // Keep on processing until the null terminator in the text buffer is reached. + while (*textmsg != '\0') + { + // Copy pointer for current character into the temporary buffer. + c = *textmsg; + // If c is a newline, move to the next available line. + if (c == '\n') + { + TTFRectCheck.x = 0; + TTFRectCheck.y += (currentfontpoint + 1); + } + // Otherwise... + else + { + // If the previous character was a newline, actually move to the next line. + if (prevc == '\n') + { + if (textbuffer != NULL) + { + // Render cached text to the SDL surface. + I_TTFRendSurface(textbuffer, font, quality, fontfgcolor, fontbgcolor); + // Empty text buffer. + memset(textbuffer, '\0', 1); + } + TTFRect.x = TTFRectCheck.x; + TTFRect.y = TTFRectCheck.y; + } + // Copy the character to the text buffer. + sprintf(textbuffer, "%s%c", textbuffer, c); + // Hack to allow TTF_SizeText to work properly. + sprintf(linebuffer, "%c", c); + // If we have reached the end of the screen, move to the next available line. + TTF_SizeText(currentfont, linebuffer, &w, &h); + TTFRectCheck.x += w; + if (TTFRectCheck.x >= res.width) + { + // Render cached text to the SDL surface. + I_TTFRendSurface(textbuffer, font, quality, fontfgcolor, fontbgcolor); + // Empty text buffer. + memset(textbuffer, '\0', 1); + // Move to the next line. + TTFRectCheck.x = 0; + TTFRectCheck.y += (currentfontpoint + 1); + // Set stored co-ordinates for next line. + TTFRect.x = TTFRectCheck.x; + TTFRect.y = TTFRectCheck.y; + } + } + // Add 1 to the pointer reference for the character to process. + textmsg++; + // Copy contents of the now-old buffer to somewhere else, so it can be referenced in next loop. + prevc = c; + } + + // If the buffer was previously emptied by a line wrapping operation and + // no text came after that, don't print anything. Otherwise, print everything + // still in the buffer. + if (textbuffer != NULL) + { + // Render cached text to the SDL surface. + I_TTFRendSurface(textbuffer, font, quality, fontfgcolor, fontbgcolor); + // Empty text buffer. + memset(textbuffer, '\0', 1); + // Set stored co-ordinates for next line. + TTFRect.x = TTFRectCheck.x; + TTFRect.y = TTFRectCheck.y; + } +} + +// Initialise SDL_ttf. +void I_StartupTTF(UINT32 fontpointsize, Uint32 initflags, Uint32 vidmodeflags) +{ + char *fontpath = NULL; + INT32 fontstatus = -1; +#ifdef _PS3 + videoState state; + videoGetState(0, 0, &state); + videoGetResolution(state.displayMode.resolution, &res); + bitsperpixel = 24; +#else + res.width = 320; + res.height = 200; + bitsperpixel = 8; +#endif + + // what's the point of trying to display an error? + // SDL_ttf is not started, can't display anything to screen (presumably)... + if (SDL_InitSubSystem(initflags) < 0) + I_Error("Couldn't initialize SDL: %s\n", SDL_GetError()); + + TTFSurface = SDL_SetVideoMode(res.width, res.height, bitsperpixel, vidmodeflags); + if (!TTFSurface) + I_Error("Couldn't set SDL Video resolution: %s\n", SDL_GetError()); + + if (TTF_Init() < 0) + I_Error("Couldn't start SDL_ttf: %s\n", TTF_GetError()); + + // look for default font in many directories +#ifdef FONTSEARCHPATH1 + fontpath = searchFont(FONTSEARCHPATH1); + if (fontpath) fontstatus = I_TTFLoadFont(fontpath, fontpointsize); +#endif +#ifdef FONTSEARCHPATH2 + if (fontstatus < 0) + { + fontpath = searchFont(FONTSEARCHPATH2); + if (fontpath) fontstatus = I_TTFLoadFont(fontpath, fontpointsize); + } +#endif +#ifdef FONTSEARCHPATH3 + if (fontstatus < 0) + { + fontpath = searchFont(FONTSEARCHPATH3); + if (fontpath) fontstatus = I_TTFLoadFont(fontpath, fontpointsize); + } +#endif +#ifdef FONTSEARCHPATH4 + if (fontstatus < 0) + { + fontpath = searchFont(FONTSEARCHPATH4); + if (fontpath) fontstatus = I_TTFLoadFont(fontpath, fontpointsize); + } +#endif +#ifdef FONTSEARCHPATH5 + if (fontstatus < 0) + { + fontpath = searchFont(FONTSEARCHPATH5); + if (fontpath) fontstatus = I_TTFLoadFont(fontpath, fontpointsize); + } +#endif +#ifdef FONTSEARCHPATH6 + if (fontstatus < 0) + { + fontpath = searchFont(FONTSEARCHPATH6); + if (fontpath) fontstatus = I_TTFLoadFont(fontpath, fontpointsize); + } +#endif +#ifdef FONTSEARCHPATH7 + if (fontstatus < 0) + { + fontpath = searchFont(FONTSEARCHPATH7); + if (fontpath) fontstatus = I_TTFLoadFont(fontpath, fontpointsize); + } +#endif + // argh! no font file found! disable SDL_ttf code + if (fontstatus < 0) + { + I_ShutdownTTF(); + CONS_Printf("Unable to find default font files! Not loading SDL_ttf\n"); + } + else + { + // Get SDL_ttf compiled and linked version + SDL_version TTFcompiled; + const SDL_version *TTFlinked; + + SDL_TTF_VERSION(&TTFcompiled); + TTFlinked = TTF_Linked_Version(); + + // Display it on screen + CONS_Printf("Compiled for SDL_ttf version: %d.%d.%d\n", + TTFcompiled.major, TTFcompiled.minor, TTFcompiled.patch); + CONS_Printf("Linked with SDL_ttf version: %d.%d.%d\n", + TTFlinked->major, TTFlinked->minor, TTFlinked->patch); + } +} + +void I_ShutdownTTF(void) +{ + // close current font + TTF_CloseFont(currentfont); + // shutdown SDL_ttf + TTF_Quit(); + + // Free TTF rendering surfaces. + SDL_FreeSurface(TTFSurface); + SDL_FreeSurface(TTFRendSurface); +} +#endif diff --git a/src/sdl12/i_ttf.h b/src/sdl12/i_ttf.h new file mode 100644 index 000000000..929c8021c --- /dev/null +++ b/src/sdl12/i_ttf.h @@ -0,0 +1,88 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright (C) 2011 by Callum Dickinson. +// +// 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 SDL_ttf interface code. Necessary for platforms with SDL inits that need to run immediately. + +#ifndef __I_TTF__ +#define __I_TTF__ + +#include "../doomdef.h" +#include "SDL_ttf.h" + +// Default name for standard TTF file. +#define FONTFILE "srb2.ttf" +#define FONTPOINTSIZE 12 + +// Default font foreground colours +#define DEFAULTFONTFGR 255 +#define DEFAULTFONTFGG 255 +#define DEFAULTFONTFGB 255 +#define DEFAULTFONTFGA 255 + +// Default font background colours +#define DEFAULTFONTBGR 0 +#define DEFAULTFONTBGG 0 +#define DEFAULTFONTBGB 0 +#define DEFAULTFONTBGA 255 + +#ifndef SDL_TTF_COMPILEDVERSION +#define SDL_TTF_COMPILEDVERSION \ + SDL_VERSIONNUM(TTF_MAJOR_VERSION, TTF_MINOR_VERSION, TTF_PATCHLEVEL) +#endif + +#ifndef SDL_TTF_VERSION_ATLEAST +#define SDL_TTF_VERSION_ATLEAST(X, Y, Z) \ + (SDL_TTF_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) +#endif + +TTF_Font* currentfont; +int currentfontpoint; +int currentfontstyle; +#if SDL_TTF_VERSION_ATLEAST(2,0,10) +int currentfontkerning; +int currentfonthinting; +int currentfontoutline; +#endif + +#ifndef _PS3 +typedef struct +{ + UINT16 width; + UINT16 height; +} VideoResolution; +#endif +UINT8 bitsperpixel; + +typedef enum +{ + solid, + shaded, + blended +} TextQuality; + +// Load TTF font from file. +INT32 I_TTFLoadFont(const char *file, UINT32 ptsize); + +// Draw TTF text to screen. It will accept four colour vales (red, green, blue and alpha) +// with foreground for draw modes Solid and Blended, and an extra four values for background +// colour with draw type Shaded. +void I_TTFDrawText(TTF_Font *font, TextQuality quality, INT32 fgR, INT32 fgG, INT32 fgB, INT32 fgA, INT32 bgR, INT32 bgG, INT32 bgB, INT32 bgA, const char *textmsg); + +// Initialise SDL_ttf. +void I_StartupTTF(UINT32 fontpointsize, Uint32 initflags, Uint32 vidmodeflags); + +void I_ShutdownTTF(void); +#endif diff --git a/src/sdl12/i_video.c b/src/sdl12/i_video.c new file mode 100644 index 000000000..197924eda --- /dev/null +++ b/src/sdl12/i_video.c @@ -0,0 +1,2100 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright (C) 1993-1996 by id Software, Inc. +// Portions 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 SRB2 graphics stuff for SDL + +#include + +#ifndef _WIN32_WCE +#include +#endif + +#ifdef _MSC_VER +#pragma warning(disable : 4214 4244) +#endif + +#ifdef HAVE_SDL + +#include "SDL.h" + +#ifdef _MSC_VER +#pragma warning(default : 4214 4244) +#endif + +#if SDL_VERSION_ATLEAST(1,2,9) && defined (_arch_dreamcast) +#define HAVE_DCSDL +#include "SDL_dreamcast.h" +#endif + +#if SDL_VERSION_ATLEAST(1,2,9) && defined (GP2X) +#define HAVE_GP2XSDL +#include "SDL_gp2x.h" +#endif + +#if SDL_VERSION_ATLEAST(1,3,0) +#define SDLK_EQUALS SDLK_KP_EQUALSAS400 +#define SDLK_LMETA SDLK_LGUI +#define SDLK_RMETA SDLK_RGUI +#else +#define HAVE_SDLMETAKEYS +#endif + +#ifdef HAVE_TTF +#include "i_ttf.h" +#endif + +#ifdef HAVE_IMAGE +#include "SDL_image.h" +#elseif !(defined (DC) || defined (_WIN32_WCE) || defined (PSP) || defined(GP2X)) +#define LOAD_XPM //I want XPM! +#include "IMG_xpm.c" //Alam: I don't want to add SDL_Image.dll/so +#define HAVE_IMAGE //I have SDL_Image, sortof +#endif + +#ifdef HAVE_IMAGE +#include "SDL_icon.xpm" +#endif + +#include "../doomdef.h" + +#if defined (_WIN32) && !defined (_XBOX) +#include "SDL_syswm.h" +#endif + +#ifdef _arch_dreamcast +#include +#include +#include +//#include "SRB2DC/VMU.xbm" +//#include +//#define malloc pvr_mem_malloc +//#define free pvr_mem_free +#endif + +#if defined (_XBOX) && defined (__GNUC__) +#include +#endif + +#include "../doomstat.h" +#include "../i_system.h" +#include "../v_video.h" +#include "../m_argv.h" +#include "../m_menu.h" +#include "../d_main.h" +#include "../s_sound.h" +#include "../i_sound.h" // midi pause/unpause +#include "../i_joy.h" +#include "../st_stuff.h" +#include "../g_game.h" +#include "../i_video.h" +#include "../console.h" +#include "../command.h" +#include "sdlmain.h" +#ifdef HWRENDER +#include "../hardware/hw_main.h" +#include "../hardware/hw_drv.h" +// For dynamic referencing of HW rendering functions +#include "hwsym_sdl.h" +#include "ogl_sdl.h" +#endif + +#ifdef REMOTE_DEBUGGING +#ifdef _WII +#include +#endif +#endif + +#ifdef HAVE_FILTER +#define FILTERS +#include "filter/filters.h" +#endif + +// maximum number of windowed modes (see windowedModes[][]) +#if defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined(GP2X) +#define MAXWINMODES (1) +#elif defined (WII) +#define MAXWINMODES (8) +#elif defined (_PS3) +#define MAXWINMODES (26) +#else +#define MAXWINMODES (27) +#endif + +/** \brief +*/ +static INT32 numVidModes = -1; + +/** \brief +*/ +static char vidModeName[33][32]; // allow 33 different modes + +rendermode_t rendermode=render_soft; + +boolean highcolor = false; + +// synchronize page flipping with screen refresh +#if defined(DC) || (defined(GP2X) && !defined(HAVE_GP2XSDL)) +consvar_t cv_vidwait = {"vid_wait", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +#else +consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +#endif +static consvar_t cv_stretch = {"stretch", "Off", CV_SAVE|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + +UINT8 graphics_started = 0; // Is used in console.c and screen.c + +// To disable fullscreen at startup; is set in VID_PrepareModeList +boolean allow_fullscreen = false; +static SDL_bool disable_fullscreen = SDL_FALSE; +#define USE_FULLSCREEN (disable_fullscreen||!allow_fullscreen)?0:cv_fullscreen.value +static SDL_bool disable_mouse = SDL_FALSE; +#define USE_MOUSEINPUT (!disable_mouse && cv_usemouse.value && SDL_GetAppState() & SDL_APPACTIVE) +#define MOUSE_MENU false //(!disable_mouse && cv_usemouse.value && menuactive && !USE_FULLSCREEN) +#define MOUSEBUTTONS_MAX MOUSEBUTTONS + +// first entry in the modelist which is not bigger than MAXVIDWIDTHxMAXVIDHEIGHT +static INT32 firstEntry = 0; + +// SDL vars +#ifndef HWRENDER //[segabor] !!! I had problem compiling this source with gcc 3.3 +static SDL_Surface *vidSurface = NULL; +#endif +static SDL_Surface *bufSurface = NULL; +static SDL_Surface *icoSurface = NULL; +static SDL_Color localPalette[256]; +static SDL_Rect **modeList = NULL; +#ifdef DC +static Uint8 BitsPerPixel = 15; +#else +static Uint8 BitsPerPixel = 16; +#endif +static Uint16 realwidth = BASEVIDWIDTH; +static Uint16 realheight = BASEVIDHEIGHT; +#ifdef _WIN32_WCE +static const Uint32 surfaceFlagsW = SDL_HWPALETTE; //Can't handle WinCE changing sides +#else +static const Uint32 surfaceFlagsW = SDL_HWPALETTE/*|SDL_RESIZABLE*/; +#endif +#ifdef _PSP +static const Uint32 surfaceFlagsF = SDL_HWSURFACE|SDL_FULLSCREEN; +#else +static const Uint32 surfaceFlagsF = SDL_HWPALETTE|SDL_FULLSCREEN; +#endif +static SDL_bool mousegrabok = SDL_TRUE; +#define HalfWarpMouse(x,y) SDL_WarpMouse((Uint16)(x/2),(Uint16)(y/2)) +#if defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined(GP2X) +static SDL_bool videoblitok = SDL_TRUE; +#else +static SDL_bool videoblitok = SDL_FALSE; +#endif +static SDL_bool exposevideo = SDL_FALSE; + +// windowed video modes from which to choose from. +static INT32 windowedModes[MAXWINMODES][2] = +{ +#if !(defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined (GP2X)) +#ifndef WII +#ifndef _PS3 + {1920,1200}, // 1.60,6.00 +#endif + {1680,1050}, // 1.60,5.25 + {1600,1200}, // 1.33,5.00 + {1600,1000}, // 1.60,5.00 + {1536,1152}, // 1.33,4.80 + {1536, 960}, // 1.60,4.80 + {1440, 900}, // 1.60,4.50 + {1400,1050}, // 1.33,4.375 + {1400, 875}, // 1.60,4.375 + {1360, 850}, // 1.60,4.25 + {1280, 960}, // 1.33,4.00 + {1280, 800}, // 1.60,4.00 + {1152, 864}, // 1.33,3.60 + {1120, 700}, // 1.60,3.50 + {1024, 768}, // 1.33,3.20 + { 960, 720}, // 1.33,3.00 + { 960, 600}, // 1.60,3.00 + { 800, 600}, // 1.33,2.50 + { 800, 500}, // 1.60,2.50 +#endif + { 640, 480}, // 1.33,2.00 + { 640, 400}, // 1.60,2.00 + { 576, 432}, // 1.33,1.80 + { 512, 384}, // 1.33,1.60 + { 416, 312}, // 1.33,1.30 + { 400, 300}, // 1.33,1.25 + { 320, 240}, // 1.33,1.00 +#endif + { 320, 200}, // 1.60,1.00 +}; + +static void SDLSetMode(INT32 width, INT32 height, INT32 bpp, Uint32 flags) +{ + const char *SDLVD = I_GetEnv("SDL_VIDEODRIVER"); +#ifdef _WIN32_WCE + if (bpp < 16) + bpp = 16; // 256 mode poo +#endif +#ifdef _WII + bpp = 16; // 8-bit mode poo +#endif +#ifdef DC + if (bpp < 15) + bpp = 15; + height = 240; +#endif +#ifdef PSP + bpp = 16; +#endif +#ifdef GP2X + bpp = 16; +#ifdef HAVE_GP2XSDL + height = 240; +#endif +#endif +#ifdef FILTERS + bpp = Setupf2x(width, height, bpp); +#endif + if (SDLVD && strncasecmp(SDLVD,"glSDL",6) == 0) //for glSDL videodriver + vidSurface = SDL_SetVideoMode(width, height,0,SDL_DOUBLEBUF); +#ifdef _WII // don't want it to use HWSURFACE, so make it first here + else if (SDL_VideoModeOK(width, height, bpp, flags|SDL_SWSURFACE|SDL_DOUBLEBUF) >= bpp) // SDL Wii uses double buffering + vidSurface = SDL_SetVideoMode(width, height, bpp, flags|SDL_SWSURFACE|SDL_DOUBLEBUF); +#endif + else if (cv_vidwait.value && videoblitok && SDL_VideoModeOK(width, height, bpp, flags|SDL_HWSURFACE|SDL_DOUBLEBUF) >= bpp) + vidSurface = SDL_SetVideoMode(width, height, bpp, flags|SDL_HWSURFACE|SDL_DOUBLEBUF); + else if (videoblitok && SDL_VideoModeOK(width, height, bpp, flags|SDL_HWSURFACE) >= bpp) + vidSurface = SDL_SetVideoMode(width, height, bpp, flags|SDL_HWSURFACE); + else if (SDL_VideoModeOK(width, height, bpp, flags|SDL_SWSURFACE) >= bpp) + vidSurface = SDL_SetVideoMode(width, height, bpp, flags|SDL_SWSURFACE); + else return; + realwidth = (Uint16)width; + realheight = (Uint16)height; +#ifdef HAVE_DCSDL + //SDL_DC_SetWindow(320,200); + SDL_DC_EmulateMouse(SDL_FALSE); + SDL_DC_EmulateKeyboard(SDL_TRUE); +#endif +#ifdef HAVE_GP2XSDL + SDL_ShowCursor(SDL_DISABLE); //For GP2X Open2x +#endif +#ifdef FILTERS + if (vidSurface && preSurface && f2xSurface) + { + vid.width = width/2; + vid.height = height/2; + } +#endif +} + +// +// Translates the SDL key into SRB2 key +// + +static INT32 SDLatekey(SDLKey sym) +{ + INT32 rc = sym + 0x80; + +#ifdef _WIN32_WCE + if (sym == SDLK_KP8) + sym = SDLK_UP; + else if (sym == SDLK_KP4) + sym = SDLK_LEFT; + else if (sym == SDLK_KP6) + sym = SDLK_RIGHT; + else if (sym == SDLK_KP2) + sym = SDLK_DOWN; +#endif + + switch (sym) + { + case SDLK_LEFT: + rc = KEY_LEFTARROW; + break; + case SDLK_RIGHT: + rc = KEY_RIGHTARROW; + break; + case SDLK_DOWN: + rc = KEY_DOWNARROW; + break; + case SDLK_UP: + rc = KEY_UPARROW; + break; + + case SDLK_ESCAPE: + rc = KEY_ESCAPE; + break; + case SDLK_SPACE: + rc = KEY_SPACE; + break; + case SDLK_RETURN: + case SDLK_KP_ENTER: + rc = KEY_ENTER; + break; + case SDLK_TAB: + rc = KEY_TAB; + break; + case SDLK_F1: + rc = KEY_F1; + break; + case SDLK_F2: + rc = KEY_F2; + break; + case SDLK_F3: + rc = KEY_F3; + break; + case SDLK_F4: + rc = KEY_F4; + break; + case SDLK_F5: + rc = KEY_F5; + break; + case SDLK_F6: + rc = KEY_F6; + break; + case SDLK_F7: + rc = KEY_F7; + break; + case SDLK_F8: + rc = KEY_F8; + break; + case SDLK_F9: + rc = KEY_F9; + break; + case SDLK_F10: + rc = KEY_F10; + break; + case SDLK_F11: + rc = KEY_F11; + break; + case SDLK_F12: + rc = KEY_F12; + break; + + case SDLK_BACKSPACE: + rc = KEY_BACKSPACE; + break; + case SDLK_DELETE: + rc = KEY_DEL; + break; + + case SDLK_KP_EQUALS: //Alam & Logan: WTF? Mac KB haves one! XD + case SDLK_PAUSE: + rc = KEY_PAUSE; + break; + + case SDLK_EQUALS: + case SDLK_PLUS: + rc = KEY_EQUALS; + break; + + case SDLK_MINUS: + rc = KEY_MINUS; + break; + + case SDLK_LSHIFT: + rc = KEY_LSHIFT; + break; + + case SDLK_RSHIFT: + rc = KEY_RSHIFT; + break; + + case SDLK_CAPSLOCK: + rc = KEY_CAPSLOCK; + break; + + case SDLK_LCTRL: + rc = KEY_LCTRL; + break; + case SDLK_RCTRL: + rc = KEY_RCTRL; + break; + + case SDLK_LALT: + rc = KEY_LALT; + break; + case SDLK_RALT: + rc = KEY_RALT; + break; + + case SDLK_NUMLOCK: + rc = KEY_NUMLOCK; + break; + case SDLK_SCROLLOCK: + rc = KEY_SCROLLLOCK; + break; + + case SDLK_PAGEUP: + rc = KEY_PGUP; + break; + case SDLK_PAGEDOWN: + rc = KEY_PGDN; + break; + case SDLK_END: + rc = KEY_END; + break; + case SDLK_HOME: + rc = KEY_HOME; + break; + case SDLK_INSERT: + rc = KEY_INS; + break; + + case SDLK_KP0: + rc = KEY_KEYPAD0; + break; + case SDLK_KP1: + rc = KEY_KEYPAD1; + break; + case SDLK_KP2: + rc = KEY_KEYPAD2; + break; + case SDLK_KP3: + rc = KEY_KEYPAD3; + break; + case SDLK_KP4: + rc = KEY_KEYPAD4; + break; + case SDLK_KP5: + rc = KEY_KEYPAD5; + break; + case SDLK_KP6: + rc = KEY_KEYPAD6; + break; + case SDLK_KP7: + rc = KEY_KEYPAD7; + break; + case SDLK_KP8: + rc = KEY_KEYPAD8; + break; + case SDLK_KP9: + rc = KEY_KEYPAD9; + break; + + case SDLK_KP_PERIOD: + rc = KEY_KPADDEL; + break; + case SDLK_KP_DIVIDE: + rc = KEY_KPADSLASH; + break; + case SDLK_KP_MULTIPLY: + rc = '*'; + break; + case SDLK_KP_MINUS: + rc = KEY_MINUSPAD; + break; + case SDLK_KP_PLUS: + rc = KEY_PLUSPAD; + break; + +#ifndef _arch_dreamcast + case SDLK_LSUPER: +#ifdef HAVE_SDLMETAKEYS + case SDLK_LMETA: +#endif + rc = KEY_LEFTWIN; + break; + case SDLK_RSUPER: +#ifdef HAVE_SDLMETAKEYS + case SDLK_RMETA: +#endif + rc = KEY_RIGHTWIN; + break; + + case SDLK_MENU: + rc = KEY_MENU; + break; +#endif + + default: + if (sym >= SDLK_SPACE && sym <= SDLK_DELETE) + rc = sym - SDLK_SPACE + ' '; + else if (sym >= 'A' && sym <= 'Z') + rc = sym - 'A' + 'a'; + else if (sym) + { + I_OutputMsg("Unknown Keycode %i, Name: %s\n",sym, SDL_GetKeyName( sym )); + } + else if (!sym) rc = 0; + break; + } + + return rc; +} + +static void SDLdoUngrabMouse(void) +{ + if (SDL_GRAB_ON == SDL_WM_GrabInput(SDL_GRAB_QUERY)) + { + SDL_WM_GrabInput(SDL_GRAB_OFF); + } +} + +void SDLforceUngrabMouse(void) +{ + if (SDL_WasInit(SDL_INIT_VIDEO)==SDL_INIT_VIDEO) + SDL_WM_GrabInput(SDL_GRAB_OFF); +} + +static void VID_Command_NumModes_f (void) +{ + CONS_Printf(M_GetText("%d video mode(s) available(s)\n"), VID_NumModes()); +} + +static void SurfaceInfo(const SDL_Surface *infoSurface, const char *SurfaceText) +{ + INT32 vfBPP; + const SDL_Surface *VidSur = SDL_GetVideoSurface(); + + if (!infoSurface) + return; + + if (!SurfaceText) + SurfaceText = M_GetText("Unknown Surface"); + + vfBPP = infoSurface->format?infoSurface->format->BitsPerPixel:0; + + CONS_Printf("\x82" "%s\n", SurfaceText); + CONS_Printf(M_GetText(" %ix%i at %i bit color\n"), infoSurface->w, infoSurface->h, vfBPP); + + if (infoSurface->flags&SDL_HWSURFACE) + CONS_Printf("%s", M_GetText(" Stored in video memory\n")); + else if (infoSurface->flags&SDL_OPENGL) + CONS_Printf("%s", M_GetText(" Stored in an OpenGL context\n")); + else if (infoSurface->flags&SDL_PREALLOC) + CONS_Printf("%s", M_GetText(" Uses preallocated memory\n")); + else + CONS_Printf("%s", M_GetText(" Stored in system memory\n")); + + if (infoSurface->flags&SDL_ASYNCBLIT) + CONS_Printf("%s", M_GetText(" Uses asynchronous blits if possible\n")); + else + CONS_Printf("%s", M_GetText(" Uses synchronous blits if possible\n")); + + if (infoSurface->flags&SDL_ANYFORMAT) + CONS_Printf("%s", M_GetText(" Allows any pixel-format\n")); + + if (infoSurface->flags&SDL_HWPALETTE) + CONS_Printf("%s", M_GetText(" Has exclusive palette access\n")); + else if (VidSur == infoSurface) + CONS_Printf("%s", M_GetText(" Has nonexclusive palette access\n")); + + if (infoSurface->flags&SDL_DOUBLEBUF) + CONS_Printf("%s", M_GetText(" Double buffered\n")); + else if (VidSur == infoSurface) + CONS_Printf("%s", M_GetText(" No hardware flipping\n")); + + if (infoSurface->flags&SDL_FULLSCREEN) + CONS_Printf("%s", M_GetText(" Full screen\n")); + else if (infoSurface->flags&SDL_RESIZABLE) + CONS_Printf("%s", M_GetText(" Resizable window\n")); + else if (VidSur == infoSurface) + CONS_Printf("%s", M_GetText(" Nonresizable window\n")); + + if (infoSurface->flags&SDL_HWACCEL) + CONS_Printf("%s", M_GetText(" Uses hardware acceleration blit\n")); + if (infoSurface->flags&SDL_SRCCOLORKEY) + CONS_Printf("%s", M_GetText(" Use colorkey blitting\n")); + if (infoSurface->flags&SDL_RLEACCEL) + CONS_Printf("%s", M_GetText(" Colorkey RLE acceleration blit\n")); + if (infoSurface->flags&SDL_SRCALPHA) + CONS_Printf("%s", M_GetText(" Use alpha blending acceleration blit\n")); + +} + +static void VID_Command_Info_f (void) +{ + const SDL_VideoInfo *videoInfo; + videoInfo = SDL_GetVideoInfo(); //Alam: Double-Check + if (videoInfo) + { + CONS_Printf("%s", M_GetText("Video Interface Capabilities:\n")); + if (videoInfo->hw_available) + CONS_Printf("%s", M_GetText(" Hardware surfaces\n")); + if (videoInfo->wm_available) + CONS_Printf("%s", M_GetText(" Window manager\n")); + //UnusedBits1 :6 + //UnusedBits2 :1 + if (videoInfo->blit_hw) + CONS_Printf("%s", M_GetText(" Accelerated blits HW-2-HW\n")); + if (videoInfo->blit_hw_CC) + CONS_Printf("%s", M_GetText(" Accelerated blits HW-2-HW with Colorkey\n")); + if (videoInfo->wm_available) + CONS_Printf("%s", M_GetText(" Accelerated blits HW-2-HW with Alpha\n")); + if (videoInfo->blit_sw) + { + CONS_Printf("%s", M_GetText(" Accelerated blits SW-2-HW\n")); + if (!M_CheckParm("-noblit")) videoblitok = SDL_TRUE; + } + if (videoInfo->blit_sw_CC) + CONS_Printf("%s", M_GetText(" Accelerated blits SW-2-HW with Colorkey\n")); + if (videoInfo->blit_sw_A) + CONS_Printf("%s", M_GetText(" Accelerated blits SW-2-HW with Alpha\n")); + if (videoInfo->blit_fill) + CONS_Printf("%s", M_GetText(" Accelerated Color filling\n")); + //UnusedBits3 :16 + if (videoInfo->video_mem) + CONS_Printf(M_GetText(" There is %i KB of video memory\n"), videoInfo->video_mem); + else + CONS_Printf("%s", M_GetText(" There no video memory for SDL\n")); + //*vfmt + } + SurfaceInfo(bufSurface, M_GetText("Current Engine Mode")); +#ifdef FILTERS + SurfaceInfo(preSurface, M_GetText("Prebuffer Mode")); + SurfaceInfo(f2xSurface, M_GetText("Postbuffer Mode")); +#endif + SurfaceInfo(vidSurface, M_GetText("Current Video Mode")); +} + +static void VID_Command_ModeList_f(void) +{ +#if !defined (DC) && !defined (_WIN32_WCE) && !defined (_PSP) && !defined(GP2X) + INT32 i; +#ifdef HWRENDER + if (rendermode == render_opengl) + modeList = SDL_ListModes(NULL, SDL_OPENGL|SDL_FULLSCREEN); + else +#endif + modeList = SDL_ListModes(NULL, surfaceFlagsF|SDL_HWSURFACE); //Alam: At least hardware surface + + if (modeList == (SDL_Rect **)0 && cv_fullscreen.value) + { + CONS_Printf("%s", M_GetText("No video modes present\n")); + cv_fullscreen.value = 0; + } + else if (modeList != (SDL_Rect **)0) + { + numVidModes = 0; + if (modeList == (SDL_Rect **)-1) + numVidModes = -1; // should not happen with fullscreen modes + else while (modeList[numVidModes]) + numVidModes++; + } + CONS_Printf(M_GetText("Found %d FullScreen Video Modes:\n"), numVidModes); + for (i=0 ; i= numVidModes) + break; + + CONS_Printf(M_GetText("%dx%d and "), + modeList[modeNum]->w, + modeList[modeNum]->h); + } + CONS_Printf("%s", M_GetText("None\n")); +#endif +} + +static void VID_Command_Mode_f (void) +{ + INT32 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()) + CONS_Printf(M_GetText("Video mode not present\n")); + else + setmodeneeded = modenum+1; // request vid mode change +} + +#if defined(RPC_NO_WINDOWS_H) && !defined(_WIN32_WCE) +static VOID MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + UNREFERENCED_PARAMETER(hWnd); + UNREFERENCED_PARAMETER(message); + UNREFERENCED_PARAMETER(wParam); + switch (message) + { + case WM_SETTEXT: + COM_BufAddText((LPCSTR)lParam); + break; + } +} +#endif + +#if 0 //#ifdef _WIN32 + // 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 + +static inline void SDLJoyRemap(event_t *event) +{ +#if defined(GP2X) +#define GP2X_BUTTON_UP (0) +#define GP2X_BUTTON_DOWN (4) +#define GP2X_BUTTON_LEFT (2) +#define GP2X_BUTTON_RIGHT (6) +#define GP2X_BUTTON_UPLEFT (1) +#define GP2X_BUTTON_UPRIGHT (7) +#define GP2X_BUTTON_DOWNLEFT (3) +#define GP2X_BUTTON_DOWNRIGHT (5) +#define GP2X_BUTTON_CLICK (18) +#define GP2X_BUTTON_A (12) +#define GP2X_BUTTON_B (13) +#define GP2X_BUTTON_X (14) +#define GP2X_BUTTON_Y (15) +#define GP2X_BUTTON_L (10) +#define GP2X_BUTTON_R (11) +#define GP2X_BUTTON_START (8) +#define GP2X_BUTTON_SELECT (9) +#define GP2X_BUTTON_VOLUP (16) +#define GP2X_BUTTON_VOLDOWN (17) + if ((event->type == ev_keydown || event->type == ev_keyup) && (KEY_JOY1 <= event->data1 && event->data1 <= KEY_JOY1+JOYBUTTONS)) + { + INT32 button = event->data1-KEY_JOY1; + if (button <= 7) + { + static UINT8 DPAD = 0; + if (event->type == ev_keyup) + { + event->type = ev_console; + DPAD &= ~(1<type = ev_joystick; + DPAD |= 1<data2 = event->data3 = INT32_MAX; + if ((DPAD & (1<type = ev_joystick; + event->data2 = event->data3 = 0; + } + else switch (button) + { + case GP2X_BUTTON_UP: + event->data3 = -1; + break; + case GP2X_BUTTON_DOWN: + event->data3 = 1; + break; + case GP2X_BUTTON_LEFT: + event->data2 = -1; + break; + case GP2X_BUTTON_RIGHT: + event->data2 = 1; + break; + case GP2X_BUTTON_UPLEFT: + event->data2 = -1; + event->data3 = -1; + break; + case GP2X_BUTTON_UPRIGHT: + event->data2 = 1; + event->data3 = -1; + break; + case GP2X_BUTTON_DOWNLEFT: + event->data2 = -1; + event->data3 = 1; + break; + case GP2X_BUTTON_DOWNRIGHT: + event->data2 = 1; + event->data3 = 1; + default: + break; + } + event->data1 = 0; + return; + } + else switch (button) + { + case GP2X_BUTTON_CLICK: + event->data1 = KEY_ENTER; + break; + case GP2X_BUTTON_A: + event->data1 = KEY_JOY1+0; + break; + case GP2X_BUTTON_B: + event->data1 = KEY_JOY1+2; + break; + case GP2X_BUTTON_X: + event->data1 = KEY_JOY1+3; + break; + case GP2X_BUTTON_Y: + event->data1 = KEY_JOY1+1; + break; + case GP2X_BUTTON_L: + event->data1 = KEY_JOY1+4; + break; + case GP2X_BUTTON_R: + event->data1 = KEY_JOY1+5; + break; + case GP2X_BUTTON_START: + event->data1 = KEY_ESCAPE; + break; + case GP2X_BUTTON_SELECT: + event->data1 = KEY_JOY1+8; + break; + case GP2X_BUTTON_VOLUP: + event->data1 = KEY_JOY1+6; + break; + case GP2X_BUTTON_VOLDOWN: + event->data1 = KEY_JOY1+7; + break; + default: + break; + } + //I_OutputMsg("Button %i: event key %i and type: %i\n", button, event->data1, event->type); + } +#elif defined(_PSP) + if (event->data1 > KEY_JOY1 + 9 + 2) // All button after D-Pad and Select/Start + event->data1 -= 4; // remap D-pad to Hats, offset of -4 + else if (event->data1 == KEY_JOY1 + 6) // Down + event->data1 = KEY_HAT1+1; + else if (event->data1 == KEY_JOY1 + 7) // Left + event->data1 = KEY_HAT1+2; + else if (event->data1 == KEY_JOY1 + 8) // Up + event->data1 = KEY_HAT1+0; + else if (event->data1 == KEY_JOY1 + 9) // Right + event->data1 = KEY_HAT1+3; + else if (event->data1 == KEY_JOY1 + 10) // Select + event->data1 = KEY_TAB; + else if (event->data1 == KEY_JOY1 + 11) // Start + event->data1 = KEY_ESCAPE; +#else + (void)event; +#endif +} + +static INT32 SDLJoyAxis(const Sint16 axis, evtype_t which) +{ +#ifdef _arch_dreamcast // -128 to 127 SDL for DC have give us a smaller range + INT32 raxis = axis*8; +#else // -32768 to 32767 + INT32 raxis = axis/32; +#endif + if (which == ev_joystick) + { + if (Joystick.bGamepadStyle) + { + // gamepad control type, on or off, live or die + if (raxis < -(JOYAXISRANGE/2)) + raxis = -1; + else if (raxis > (JOYAXISRANGE/2)) + raxis = 1; + else + raxis = 0; + } + else + { + raxis = JoyInfo.scale!=1?((raxis/JoyInfo.scale)*JoyInfo.scale):raxis; + +#ifdef SDL_JDEADZONE + if (-SDL_JDEADZONE <= raxis && raxis <= SDL_JDEADZONE) + raxis = 0; +#endif + } + } + else if (which == ev_joystick2) + { + if (Joystick2.bGamepadStyle) + { + // gamepad control type, on or off, live or die + if (raxis < -(JOYAXISRANGE/2)) + raxis = -1; + else if (raxis > (JOYAXISRANGE/2)) + raxis = 1; + else raxis = 0; + } + else + { + raxis = JoyInfo2.scale!=1?((raxis/JoyInfo2.scale)*JoyInfo2.scale):raxis; + +#ifdef SDL_JDEADZONE + if (-SDL_JDEADZONE <= raxis && raxis <= SDL_JDEADZONE) + raxis = 0; +#endif + } + } + return raxis; +} + +void I_GetEvent(void) +{ + SDL_Event inputEvent; + static SDL_bool sdlquit = SDL_FALSE; //Alam: once, just once + event_t event; + + if (!graphics_started) + return; + + memset(&inputEvent, 0x00, sizeof(inputEvent)); + while (SDL_PollEvent(&inputEvent)) + { + memset(&event,0x00,sizeof (event_t)); + switch (inputEvent.type) + { + case SDL_ACTIVEEVENT: + if (inputEvent.active.state & (SDL_APPACTIVE|SDL_APPINPUTFOCUS)) + { + // pause music when alt-tab + if (inputEvent.active.gain /*&& !paused */) + { + static SDL_bool firsttimeonmouse = SDL_TRUE; + if (!firsttimeonmouse) + { + if (cv_usemouse.value) I_StartupMouse(); + } + else firsttimeonmouse = SDL_FALSE; + //if (!netgame && !con_destlines) paused = false; + if (gamestate == GS_LEVEL) + if (!paused) I_ResumeSong(0); //resume it + } + else /*if (!paused)*/ + { + if (!disable_mouse) + SDLforceUngrabMouse(); + if (!netgame && gamestate == GS_LEVEL) paused = true; + memset(gamekeydown, 0, NUMKEYS); + //S_PauseSound(); + if (gamestate == GS_LEVEL) + I_PauseSong(0); //pause it + } + } + if (MOUSE_MENU) + { + SDLdoUngrabMouse(); + break; + } + if ((SDL_APPMOUSEFOCUS&inputEvent.active.state) && USE_MOUSEINPUT && inputEvent.active.gain) + HalfWarpMouse(realwidth, realheight); + break; + case SDL_KEYDOWN: + case SDL_KEYUP: + /// \todo inputEvent.key.which? + if (inputEvent.type == SDL_KEYUP) + event.type = ev_keyup; + else if (inputEvent.type == SDL_KEYDOWN) + event.type = ev_keydown; + else break; + event.data1 = SDLatekey(inputEvent.key.keysym.sym); + if (event.data1) D_PostEvent(&event); + break; + case SDL_MOUSEMOTION: + /// \todo inputEvent.motion.which + if (MOUSE_MENU) + { + SDLdoUngrabMouse(); + break; + } + if (USE_MOUSEINPUT) + { + // If the event is from warping the pointer back to middle + // of the screen then ignore it. + if ((inputEvent.motion.x == realwidth/2) && + (inputEvent.motion.y == realheight/2)) + { + break; + } + else + { + event.data2 = +inputEvent.motion.xrel; + event.data3 = -inputEvent.motion.yrel; + } + event.type = ev_mouse; + D_PostEvent(&event); + // Warp the pointer back to the middle of the window + // or we cannot move any further if it's at a border. + if ((inputEvent.motion.x < (realwidth/2 )-(realwidth/4 )) || + (inputEvent.motion.y < (realheight/2)-(realheight/4)) || + (inputEvent.motion.x > (realwidth/2 )+(realwidth/4 )) || + (inputEvent.motion.y > (realheight/2)+(realheight/4) ) ) + { + //if (SDL_GRAB_ON == SDL_WM_GrabInput(SDL_GRAB_QUERY) || !mousegrabok) + HalfWarpMouse(realwidth, realheight); + } + } + break; + case SDL_MOUSEBUTTONDOWN: + case SDL_MOUSEBUTTONUP: + /// \todo inputEvent.button.which + if (USE_MOUSEINPUT) + { + if (inputEvent.type == SDL_MOUSEBUTTONUP) + event.type = ev_keyup; + else if (inputEvent.type == SDL_MOUSEBUTTONDOWN) + event.type = ev_keydown; + else break; + if (inputEvent.button.button==SDL_BUTTON_WHEELUP || inputEvent.button.button==SDL_BUTTON_WHEELDOWN) + { + if (inputEvent.type == SDL_MOUSEBUTTONUP) + event.data1 = 0; //Alam: dumb! this could be a real button with some mice + else + event.data1 = KEY_MOUSEWHEELUP + inputEvent.button.button - SDL_BUTTON_WHEELUP; + } + else if (inputEvent.button.button == SDL_BUTTON_MIDDLE) + event.data1 = KEY_MOUSE1+2; + else if (inputEvent.button.button == SDL_BUTTON_RIGHT) + event.data1 = KEY_MOUSE1+1; + else if (inputEvent.button.button <= MOUSEBUTTONS) + event.data1 = KEY_MOUSE1 + inputEvent.button.button - SDL_BUTTON_LEFT; + if (event.data1) D_PostEvent(&event); + } + break; + case SDL_JOYAXISMOTION: + inputEvent.jaxis.which++; + inputEvent.jaxis.axis++; + event.data1 = event.data2 = event.data3 = INT32_MAX; + if (cv_usejoystick.value == inputEvent.jaxis.which) + { + event.type = ev_joystick; + } + else if (cv_usejoystick.value == inputEvent.jaxis.which) + { + event.type = ev_joystick2; + } + else break; + //axis + if (inputEvent.jaxis.axis > JOYAXISSET*2) + break; + //vaule + if (inputEvent.jaxis.axis%2) + { + event.data1 = inputEvent.jaxis.axis / 2; + event.data2 = SDLJoyAxis(inputEvent.jaxis.value, event.type); + } + else + { + inputEvent.jaxis.axis--; + event.data1 = inputEvent.jaxis.axis / 2; + event.data3 = SDLJoyAxis(inputEvent.jaxis.value, event.type); + } + D_PostEvent(&event); + break; + case SDL_JOYBALLMOTION: + case SDL_JOYHATMOTION: + break; //NONE + case SDL_JOYBUTTONDOWN: + case SDL_JOYBUTTONUP: + inputEvent.jbutton.which++; + if (cv_usejoystick.value == inputEvent.jbutton.which) + event.data1 = KEY_JOY1; + else if (cv_usejoystick.value == inputEvent.jbutton.which) + event.data1 = KEY_2JOY1; + else break; + if (inputEvent.type == SDL_JOYBUTTONUP) + event.type = ev_keyup; + else if (inputEvent.type == SDL_JOYBUTTONDOWN) + event.type = ev_keydown; + else break; + if (inputEvent.jbutton.button < JOYBUTTONS) + event.data1 += inputEvent.jbutton.button; + else + break; + SDLJoyRemap(&event); + if (event.type != ev_console) D_PostEvent(&event); + break; +#ifndef _WIN32_WCE + case SDL_QUIT: + if (!sdlquit) + { + sdlquit = SDL_TRUE; + M_QuitResponse('y'); + } + break; +#endif +#if defined(RPC_NO_WINDOWS_H) && !defined(_WIN32_WCE) + case SDL_SYSWMEVENT: + MainWndproc(inputEvent.syswm.msg->hwnd, + inputEvent.syswm.msg->msg, + inputEvent.syswm.msg->wParam, + inputEvent.syswm.msg->lParam); + break; +#endif + case SDL_VIDEORESIZE: + if (gamestate == GS_LEVEL || gamestate == GS_TITLESCREEN || gamestate == GS_EVALUATION) + setmodeneeded = VID_GetModeForSize(inputEvent.resize.w,inputEvent.resize.h)+1; + if (render_soft == rendermode) + { +#ifdef FILTERS + INT32 filtervalue = cv_filter.value; + if (blitfilter) CV_SetValue(&cv_filter,1); +#endif + SDLSetMode(realwidth, realheight, vid.bpp*8, surfaceFlagsW); + if (vidSurface) SDL_SetColors(vidSurface, localPalette, 0, 256); +#ifdef FILTERS + CV_SetValue(&cv_filter,filtervalue); +#endif + } + else + SDLSetMode(realwidth, realheight, vid.bpp*8, surfaceFlagsW); + if (!vidSurface) + I_Error("Could not reset vidmode: %s\n",SDL_GetError()); + break; + case SDL_VIDEOEXPOSE: + exposevideo = SDL_TRUE; + break; + default: + break; + } + } + //reset wheel like in win32, I don't understand it but works + gamekeydown[KEY_MOUSEWHEELDOWN] = gamekeydown[KEY_MOUSEWHEELUP] = 0; +} + +void I_StartupMouse(void) +{ + static SDL_bool firsttimeonmouse = SDL_TRUE; + + if (disable_mouse) + return; + + if (!firsttimeonmouse) + HalfWarpMouse(realwidth, realheight); // warp to center + else + firsttimeonmouse = SDL_FALSE; + if (cv_usemouse.value) + return; + else + SDLdoUngrabMouse(); +} + +// +// I_OsPolling +// +void I_OsPolling(void) +{ + if (consolevent) + I_GetConsoleEvents(); + if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK) + { + SDL_JoystickUpdate(); + I_GetJoystickEvents(); + I_GetJoystick2Events(); + } +#ifdef _arch_dreamcast + //vmu_set_icon(VMU_bits); +#endif + + I_GetMouseEvents(); + + I_GetEvent(); +} + +// +// I_UpdateNoBlit +// +void I_UpdateNoBlit(void) +{ + if (!vidSurface) + return; +#ifdef HWRENDER + if (rendermode != render_soft) + OglSdlFinishUpdate(cv_vidwait.value); + else +#endif + if (vidSurface->flags&SDL_DOUBLEBUF) + SDL_Flip(vidSurface); + else if (exposevideo) + SDL_UpdateRect(vidSurface, 0, 0, 0, 0); + exposevideo = SDL_FALSE; +} + +// 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; + +#if 0 //(defined (GP2X) || defined (PSP) || defined (_arch_dreamcast)) + return skip; +#endif + + switch (gamestate) + { + case GS_LEVEL: + if (!paused) + return false; + case GS_TIMEATTACK: + case GS_WAITINGPLAYERS: + return skip; // Skip odd frames + default: + return false; + } +} + +static inline SDL_bool SDLmatchVideoformat(void) +{ + const SDL_PixelFormat *vidformat = vidSurface->format; + const INT32 vfBPP = vidformat?vidformat->BitsPerPixel:0; + return (((vfBPP == 8 && vid.bpp == 1 && + !vidformat->Rmask && !vidformat->Gmask && !vidformat->Bmask) || + (vfBPP == 15 && vid.bpp == 2 && vidformat->Rmask == 0x7C00 && + vidformat->Gmask == 0x03E0 && vidformat->Bmask == 0x001F )) && + !vidformat->Amask && (vidSurface->flags & SDL_RLEACCEL) == 0); +} + +// +// I_FinishUpdate +// +void I_FinishUpdate(void) +{ + if (!vidSurface) + return; //Alam: No software or OpenGl surface + + if (I_SkipFrame()) + return; + + if (cv_ticrate.value) + SCR_DisplayTicRate(); + + if (render_soft == rendermode && screens[0]) + { + SDL_Rect *dstrect = NULL; + SDL_Rect rect = {0, 0, 0, 0}; + SDL_PixelFormat *vidformat = vidSurface->format; + int lockedsf = 0, blited = 0; + + rect.w = (Sint16)vid.width; + rect.h = (Sint16)vid.height; + + if (vidSurface->h > vid.height) + rect.y = (Sint16)((vidSurface->h-vid.height)/2); + + dstrect = ▭ + + + if (!bufSurface && !vid.direct) //Double-Check + { + if (vid.bpp == 1) bufSurface = SDL_CreateRGBSurfaceFrom(screens[0],vid.width,vid.height,8, + (int)vid.rowbytes,0x00000000,0x00000000,0x00000000,0x00000000); // 256 mode + else if (vid.bpp == 2) bufSurface = SDL_CreateRGBSurfaceFrom(screens[0],vid.width,vid.height,15, + (int)vid.rowbytes,0x00007C00,0x000003E0,0x0000001F,0x00000000); // 555 mode + if (bufSurface) SDL_SetColors(bufSurface, localPalette, 0, 256); + else I_OutputMsg("No system memory for SDL buffer surface\n"); + } + +#ifdef FILTERS + FilterBlit(bufSurface); + if (f2xSurface) //Alam: filter! + { + //I_OutputMsg("2x Filter Code\n"); + blited = SDL_BlitSurface(f2xSurface,NULL,vidSurface,NULL); + } + else +#endif +#if 0 + if (SDLmatchVideoformat() && !vid.direct)//Alam: DOS Way + { + if (SDL_MUSTLOCK(vidSurface)) lockedsf = SDL_LockSurface(vidSurface); + if (lockedsf == 0) + { + if (vidSurface->pixels > vid.height) + { + UINT8 *ptr = vidSurface->pixels; + size_t half_excess = vidSurface->pitch*(vidSurface->height-vid.height)/2; + memset(ptr, 0x1F, half_excess); + ptr += half_excess; + VID_BlitLinearScreen(screens[0], ptr, vid.width*vid.bpp, vid.height, + vid.rowbytes, vidSurface->pitch); + ptr += vid.height*vidSurface->pitch; + memset(ptr, 0x1F, half_excess); + } + else + VID_BlitLinearScreen(screens[0], vidSurface->pixels, vid.width*vid.bpp, + vid.height, vid.rowbytes, vidSurface->pitch ); + if (SDL_MUSTLOCK(vidSurface)) SDL_UnlockSurface(vidSurface); + } + } + else +#endif + if (bufSurface) //Alam: New Way to send video data + { + blited = SDL_BlitSurface(bufSurface,NULL,vidSurface,dstrect); + } + else if (vid.bpp == 1 && !vid.direct) + { + Uint8 *bP,*vP; //Src, Dst + Uint16 bW, vW; // Pitch Remainder + Sint32 pH, pW; //Height, Width + bP = (Uint8 *)screens[0]; + bW = (Uint16)(vid.rowbytes - vid.width); + //I_OutputMsg("Old Copy Code\n"); + if (SDL_MUSTLOCK(vidSurface)) lockedsf = SDL_LockSurface(vidSurface); + vP = (Uint8 *)vidSurface->pixels; + vW = (Uint16)(vidSurface->pitch - vidSurface->w*vidformat->BytesPerPixel); + if (vidSurface->h > vid.height) + vP += vidSurface->pitch*(vidSurface->h-vid.height)/2; + if (lockedsf == 0 && vidSurface->pixels) + { + if (vidformat->BytesPerPixel == 2) + { + for (pH=0;pH < vidSurface->h;pH++) + { + for (pW=0;pW < vidSurface->w;pW++) + { + *((Uint16 *)(void *)vP) = (Uint16)SDL_MapRGB(vidformat, + localPalette[*bP].r,localPalette[*bP].g,localPalette[*bP].b); + bP++; + vP += 2; + } + bP += bW; + vP += vW; + } + } + else if (vidformat->BytesPerPixel == 3) + { + for (pH=0;pH < vidSurface->h;pH++) + { + for (pW=0;pW < vidSurface->w;pW++) + { + *((Uint32 *)(void *)vP) = SDL_MapRGB(vidformat, + localPalette[*bP].r,localPalette[*bP].g,localPalette[*bP].b); + bP++; + vP += 3; + } + bP += bW; + vP += vW; + } + } + else if (vidformat->BytesPerPixel == 4) + { + for (pH=0;pH < vidSurface->h;pH++) + { + for (pW=0;pW < vidSurface->w;pW++) + { + *((Uint32 *)(void *)vP) = SDL_MapRGB(vidformat, + localPalette[*bP].r,localPalette[*bP].g,localPalette[*bP].b); + bP++; + vP += 4; + } + bP += bW; + vP += vW; + } + } + else + { + ;//NOP + } + } + if (SDL_MUSTLOCK(vidSurface)) SDL_UnlockSurface(vidSurface); + } + else /// \todo 15t15,15tN, others? + { + ;//NOP + } + +#ifdef HAVE_GP2XSDL + //if (blited == 0) + SDL_GP2X_WaitForBlitter(); +#endif + + if (lockedsf == 0 && blited == 0 && vidSurface->flags&SDL_DOUBLEBUF) + SDL_Flip(vidSurface); + else if (blited != -2 && lockedsf == 0) //Alam: -2 for Win32 Direct, yea, i know + SDL_UpdateRect(vidSurface, rect.x, rect.y, 0, 0); //Alam: almost always + else + I_OutputMsg("%s\n",SDL_GetError()); + } +#ifdef HWRENDER + else + { + OglSdlFinishUpdate(cv_vidwait.value); + } +#endif + exposevideo = SDL_FALSE; +} + +// +// I_UpdateNoVsync +// +void I_UpdateNoVsync(void) +{ + INT32 real_vidwait = cv_vidwait.value; + cv_vidwait.value = 0; + I_FinishUpdate(); + cv_vidwait.value = real_vidwait; +} + +// +// I_ReadScreen +// +void I_ReadScreen(UINT8 *scr) +{ + if (rendermode != render_soft) + I_Error ("I_ReadScreen: called while in non-software mode"); + else + VID_BlitLinearScreen(screens[0], scr, + vid.width*vid.bpp, vid.height, + vid.rowbytes, vid.rowbytes); +} + +// +// I_SetPalette +// +void I_SetPalette(RGBA_t *palette) +{ + size_t i; + for (i=0; i<256; i++) + { + localPalette[i].r = palette[i].s.red; + localPalette[i].g = palette[i].s.green; + localPalette[i].b = palette[i].s.blue; + } + if (vidSurface) SDL_SetColors(vidSurface, localPalette, 0, 256); + if (bufSurface) SDL_SetColors(bufSurface, localPalette, 0, 256); +} + +// return number of fullscreen + X11 modes +INT32 VID_NumModes(void) +{ + if (USE_FULLSCREEN && numVidModes != -1) + return numVidModes - firstEntry; + else + return MAXWINMODES; +} + +const char *VID_GetModeName(INT32 modeNum) +{ + if (USE_FULLSCREEN && numVidModes != -1) // fullscreen modes + { + modeNum += firstEntry; + if (modeNum >= numVidModes) + return NULL; + + sprintf(&vidModeName[modeNum][0], "%dx%d", + modeList[modeNum]->w, + modeList[modeNum]->h); + } + else // windowed modes + { + if (modeNum > MAXWINMODES) + return NULL; + + sprintf(&vidModeName[modeNum][0], "%dx%d", + windowedModes[modeNum][0], + windowedModes[modeNum][1]); + } + return &vidModeName[modeNum][0]; +} + +INT32 VID_GetModeForSize(INT32 w, INT32 h) +{ + INT32 matchMode = -1, i; + VID_PrepareModeList(); + if (USE_FULLSCREEN && numVidModes != -1) + { + for (i=firstEntry; iw == w && + modeList[i]->h == h) + { + matchMode = i; + break; + } + } + if (-1 == matchMode) // use smaller mode + { + w -= w%BASEVIDWIDTH; + h -= h%BASEVIDHEIGHT; + for (i=firstEntry; iw == w && + modeList[i]->h == h) + { + matchMode = i; + break; + } + } + if (-1 == matchMode) // use smallest mode + matchMode = numVidModes-1; + } + matchMode -= firstEntry; + } + else + { + for (i=0; iw <= MAXVIDWIDTH && + modeList[i]->h <= MAXVIDHEIGHT) + { + firstEntry = i; + break; + } + } + } + } + allow_fullscreen = true; +} + +static inline void SDLESSet(void) +{ +#ifdef HAVE_DCSDL + INT32 j; + SDL_DC_SetVideoDriver(SDL_DC_DIRECT_VIDEO); //SDL_DC_DMA_VIDEO + for (j=0;j<4;j++) + { + SDL_DC_MapKey(j,SDL_DC_START,SDLK_ESCAPE); + SDL_DC_MapKey(j,SDL_DC_A,SDLK_UNKNOWN); + SDL_DC_MapKey(j,SDL_DC_B,SDLK_UNKNOWN); + SDL_DC_MapKey(j,SDL_DC_X,SDLK_UNKNOWN); + SDL_DC_MapKey(j,SDL_DC_Y,SDLK_UNKNOWN); + SDL_DC_MapKey(j,SDL_DC_L,SDLK_UNKNOWN); + SDL_DC_MapKey(j,SDL_DC_R,SDLK_UNKNOWN); + //SDL_DC_MapKey(j,SDL_DC_LEFT,SDLK_UNKNOWN); + //SDL_DC_MapKey(j,SDL_DC_RIGHT,SDLK_UNKNOWN); + //SDL_DC_MapKey(j,SDL_DC_UP,SDLK_UNKNOWN); + //SDL_DC_MapKey(j,SDL_DC_DOWN,SDLK_UNKNOWN); + } + //SDL_DC_MapKey(0,SDL_DC_L,SDLK_LEFTBRACKET); + //SDL_DC_MapKey(0,SDL_DC_R,SDLK_RIGHTBRACKET); + //SDL_DC_MapKey(0,SDL_DC_START,SDLK_UNKNOWN); + //SDL_DC_MapKey(1,SDL_DC_L,SDLK_z); + //SDL_DC_MapKey(1,SDL_DC_R,SDLK_x); +#endif +#ifdef HAVE_GP2XSDL + SDL_GP2X_MiniDisplay(0,0); + //SDL_GP2X_DenyGfxMemory(NULL, 0); + SDL_GP2X_AllowGfxMemory(NULL, 0); +#endif +} + +static void SDLWMSet(void) +{ +#ifdef RPC_NO_WINDOWS_H + SDL_SysWMinfo SDLWM; + memset(&SDLWM,0,sizeof (SDL_SysWMinfo)); + SDL_VERSION(&SDLWM.version) + if (SDL_GetWMInfo(&SDLWM)) + vid.WndParent = SDLWM.window; + else + vid.WndParent = INVALID_HANDLE_VALUE; + if (vid.WndParent != INVALID_HANDLE_VALUE) + { + SetFocus(vid.WndParent); + ShowWindow(vid.WndParent, SW_SHOW); + } +#ifndef _WIN32_WCE + SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE); +#endif +#endif + SDL_EventState(SDL_VIDEORESIZE, SDL_IGNORE); +} + +static void* SDLGetDirect(void) +{ +#if 0 //#ifndef __MACH__ // Do not directly access the MacOSX's OpenGL memory + if (!SDL_MUSTLOCK(vidSurface) && SDLmatchVideoformat()) + { + vid.rowbytes = vidSurface->pitch; + return vidSurface->pixels; + } +#endif // you can not use the video memory in pixels member in fullscreen mode + return NULL; +} + +INT32 VID_SetMode(INT32 modeNum) +{ +#ifdef _WIN32_WCE + (void)modeNum; +#else + SDLdoUngrabMouse(); + vid.recalc = true; + BitsPerPixel = (Uint8)cv_scr_depth.value; + //vid.bpp = BitsPerPixel==8?1:2; + // Window title + SDL_WM_SetCaption("SRB2 "VERSIONSTRING, "SRB2"); + + if (render_soft == rendermode) + { + //Alam: SDL_Video system free vidSurface for me + if (vid.buffer) free(vid.buffer); + vid.buffer = NULL; + if (bufSurface) SDL_FreeSurface(bufSurface); + bufSurface = NULL; + } + + if (USE_FULLSCREEN) + { + if (numVidModes != -1) + { + modeNum += firstEntry; + vid.width = modeList[modeNum]->w; + vid.height = modeList[modeNum]->h; + } + else + { + vid.width = windowedModes[modeNum][0]; + vid.height = windowedModes[modeNum][1]; + } + if (render_soft == rendermode) + { + SDLSetMode(vid.width, vid.height, BitsPerPixel, surfaceFlagsF); + + if (!vidSurface) + { + cv_fullscreen.value = 0; + modeNum = VID_GetModeForSize(vid.width,vid.height); + vid.width = windowedModes[modeNum][0]; + vid.height = windowedModes[modeNum][1]; + SDLSetMode(vid.width, vid.height, BitsPerPixel, surfaceFlagsW); + if (!vidSurface) + I_Error("Could not set vidmode: %s\n",SDL_GetError()); + } + } +#ifdef HWRENDER + else // (render_soft != rendermode) + { + if (!OglSdlSurface(vid.width, vid.height, true)) + { + cv_fullscreen.value = 0; + modeNum = VID_GetModeForSize(vid.width,vid.height); + vid.width = windowedModes[modeNum][0]; + vid.height = windowedModes[modeNum][1]; + if (!OglSdlSurface(vid.width, vid.height,false)) + I_Error("Could not set vidmode: %s\n",SDL_GetError()); + } + + realwidth = (Uint16)vid.width; + realheight = (Uint16)vid.height; + } +#endif + } + else //(cv_fullscreen.value) + { + vid.width = windowedModes[modeNum][0]; + vid.height = windowedModes[modeNum][1]; + + if (render_soft == rendermode) + { + SDLSetMode(vid.width, vid.height, BitsPerPixel, surfaceFlagsW); + if (!vidSurface) + I_Error("Could not set vidmode: %s\n",SDL_GetError()); + } +#ifdef HWRENDER + else //(render_soft != rendermode) + { + if (!OglSdlSurface(vid.width, vid.height, false)) + I_Error("Could not set vidmode: %s\n",SDL_GetError()); + realwidth = (Uint16)vid.width; + realheight = (Uint16)vid.height; + } +#endif + } + + vid.modenum = VID_GetModeForSize(vidSurface->w,vidSurface->h); + + if (render_soft == rendermode) + { + vid.rowbytes = vid.width*vid.bpp; + vid.direct = SDLGetDirect(); + vid.buffer = malloc(vid.rowbytes*vid.height*NUMSCREENS); + if (vid.buffer) memset(vid.buffer,0x00,vid.rowbytes*vid.height*NUMSCREENS); + else I_Error ("Not enough memory for video buffer\n"); + } + +#if 0 // broken + if (!cv_stretch.value && (float)vid.width/vid.height != ((float)BASEVIDWIDTH/BASEVIDHEIGHT)) + vid.height = (INT32)(vid.width * ((float)BASEVIDHEIGHT/BASEVIDWIDTH));// Adjust the height to match +#endif +#endif + I_StartupMouse(); + + SDLWMSet(); + + return true; +} + +void I_StartupGraphics(void) +{ + static char SDLNOMOUSE[] = "SDL_NOMOUSE=1"; + static char SDLVIDEOMID[] = "SDL_VIDEO_CENTERED=center"; + + if (dedicated) + { + rendermode = render_none; + return; + } + if (graphics_started) + return; + + COM_AddCommand ("vid_nummodes", VID_Command_NumModes_f); + COM_AddCommand ("vid_info", VID_Command_Info_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); +#ifdef FILTERS + CV_RegisterVar (&cv_filter); +#endif +#ifdef _PSP // pitch is 0, mod of 0 crash + disable_mouse = true; +#else + disable_mouse = M_CheckParm("-nomouse"); +#endif + if (disable_mouse) + I_PutEnv(SDLNOMOUSE); + if (!I_GetEnv("SDL_VIDEO_CENTERED")) + I_PutEnv(SDLVIDEOMID); + disable_fullscreen = M_CheckParm("-win"); + + keyboard_started = true; +#ifdef _arch_dreamcast + conio_shutdown(); +#endif + +#if !defined(HAVE_TTF) +#ifdef _WIN32 // Initialize Audio as well, otherwise Win32's DirectX can not use audio + if (SDL_InitSubSystem(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0) +#else //SDL_OpenAudio will do SDL_InitSubSystem(SDL_INIT_AUDIO) + if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) +#endif + { +#ifdef _WIN32 + if (SDL_WasInit(SDL_INIT_AUDIO)==0) + CONS_Printf(M_GetText("Couldn't initialize SDL's Audio System with Video System: %s\n"), SDL_GetError()); + if (SDL_WasInit(SDL_INIT_VIDEO)==0) +#endif + { + CONS_Printf(M_GetText("Couldn't initialize SDL's Video System: %s\n"), SDL_GetError()); + return; + } + } +#ifdef REMOTE_DEBUGGING +#ifdef _WII + _break(); // break for debugger +#endif +#endif +#endif + { + char vd[100]; //stack space for video name + CONS_Printf(M_GetText("Starting up with video driver : %s\n"), SDL_VideoDriverName(vd,100)); + if (strncasecmp(vd, "gcvideo", 8) == 0 || strncasecmp(vd, "fbcon", 6) == 0 || strncasecmp(vd, "wii", 4) == 0 || strncasecmp(vd, "psl1ght", 8) == 0) + framebuffer = SDL_TRUE; + } + if (M_CheckParm("-software")) + rendermode = render_soft; + SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY>>1,SDL_DEFAULT_REPEAT_INTERVAL<<2); + SDLESSet(); + VID_Command_ModeList_f(); + vid.buffer = NULL; // For software mode + vid.width = BASEVIDWIDTH; // Default size for startup + vid.height = BASEVIDHEIGHT; // BitsPerPixel is the SDL interface's + vid.recalc = true; // Set up the console stufff + vid.direct = NULL; // Maybe direct access? + vid.bpp = 1; // This is the game engine's Bpp + vid.WndParent = NULL; //For the window? + +#ifdef HAVE_TTF + I_ShutdownTTF(); +#endif + + // Window title +#ifdef _WIN32_WCE + SDL_WM_SetCaption("SRB2 "VERSIONSTRING, "SRB2"); +#else + SDL_WM_SetCaption("SRB2: Starting up", "SRB2"); +#endif + + // Window icon +#ifdef HAVE_IMAGE + icoSurface = IMG_ReadXPMFromArray(SDL_icon_xpm); +#endif + SDL_WM_SetIcon(icoSurface, NULL); + +#ifdef _WIN32 + //DisableAero(); //also disable Aero on Vista +#endif + +#ifdef HWRENDER + if (M_CheckParm("-opengl") || rendermode == render_opengl) + { + rendermode = render_opengl; + HWD.pfnInit = hwSym("Init",NULL); + HWD.pfnFinishUpdate = NULL; + HWD.pfnDraw2DLine = hwSym("Draw2DLine",NULL); + HWD.pfnDrawPolygon = hwSym("DrawPolygon",NULL); + HWD.pfnSetBlend = hwSym("SetBlend",NULL); + HWD.pfnClearBuffer = hwSym("ClearBuffer",NULL); + HWD.pfnSetTexture = hwSym("SetTexture",NULL); + HWD.pfnReadRect = hwSym("ReadRect",NULL); + HWD.pfnGClipRect = hwSym("GClipRect",NULL); + HWD.pfnClearMipMapCache = hwSym("ClearMipMapCache",NULL); + HWD.pfnSetSpecialState = hwSym("SetSpecialState",NULL); + HWD.pfnSetPalette = hwSym("SetPalette",NULL); + HWD.pfnGetTextureUsed = hwSym("GetTextureUsed",NULL); + HWD.pfnDrawMD2 = hwSym("DrawMD2",NULL); + HWD.pfnDrawMD2i = hwSym("DrawMD2i",NULL); + HWD.pfnSetTransform = hwSym("SetTransform",NULL); + HWD.pfnGetRenderVersion = hwSym("GetRenderVersion",NULL); +#ifdef SHUFFLE + HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL); +#endif + HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL); + HWD.pfnEndScreenWipe = hwSym("EndScreenWipe",NULL); + HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL); + HWD.pfnDrawIntermissionBG=hwSym("DrawIntermissionBG",NULL); + HWD.pfnMakeScreenTexture= hwSym("MakeScreenTexture",NULL); + // check gl renderer lib + if (HWD.pfnGetRenderVersion() != VERSION) + I_Error("%s", M_GetText("The version of the renderer doesn't match the version of the executable\nBe sure you have installed SRB2 properly.\n")); +#if 1 //#ifdef _WIN32_WCE + vid.width = BASEVIDWIDTH; + vid.height = BASEVIDHEIGHT; +#else + vid.width = 640; // hack to make voodoo cards work in 640x480 + vid.height = 480; +#endif + if (HWD.pfnInit(I_Error)) // let load the OpenGL library + { + /* + * We want at least 1 bit R, G, and B, + * and at least 16 bpp. Why 1 bit? May be more? + */ + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 1); + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 1); + SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 1); + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + if (!OglSdlSurface(vid.width, vid.height, (USE_FULLSCREEN))) + if (!OglSdlSurface(vid.width, vid.height, !(USE_FULLSCREEN))) + rendermode = render_soft; + } + else + rendermode = render_soft; + } +#else + rendermode = render_soft; //force software mode when there no HWRENDER code +#endif + if (render_soft == rendermode) + { +#if defined(_WII) + vid.width = 640; + vid.height = 480; +#elif defined(_PS3) + vid.width = 720; + vid.height = 480; +#else + vid.width = BASEVIDWIDTH; + vid.height = BASEVIDHEIGHT; +#endif + SDLSetMode(vid.width, vid.height, BitsPerPixel, surfaceFlagsW); + if (!vidSurface) + { + CONS_Printf(M_GetText("Could not set vidmode: %s\n") ,SDL_GetError()); + vid.rowbytes = 0; + graphics_started = true; + return; + } + vid.rowbytes = vid.width * vid.bpp; + vid.direct = SDLGetDirect(); + vid.buffer = malloc(vid.rowbytes*vid.height*NUMSCREENS); + if (vid.buffer) memset(vid.buffer,0x00,vid.rowbytes*vid.height*NUMSCREENS); + else CONS_Printf("%s", M_GetText("Not enough memory for video buffer\n")); + } + if (M_CheckParm("-nomousegrab")) + mousegrabok = SDL_FALSE; +#ifdef _DEBUG + else + { + char videodriver[4] = {'S','D','L',0}; + if (!M_CheckParm("-mousegrab") && + SDL_VideoDriverName(videodriver,4) && + strncasecmp("X11",videodriver,4) == 0) + mousegrabok = SDL_FALSE; //X11's XGrabPointer not good + } +#endif + realwidth = (Uint16)vid.width; + realheight = (Uint16)vid.height; + + VID_Command_Info_f(); + if (!disable_mouse) SDL_ShowCursor(SDL_DISABLE); + SDLdoUngrabMouse(); + + SDLWMSet(); + + graphics_started = true; +} + +void I_ShutdownGraphics(void) +{ + const rendermode_t oldrendermode = rendermode; + + rendermode = render_none; + if (icoSurface) SDL_FreeSurface(icoSurface); + icoSurface = NULL; + if (render_soft == oldrendermode) + { + vidSurface = NULL; //Alam: SDL_Video system free vidSurface for me + if (vid.buffer) free(vid.buffer); + vid.buffer = NULL; + if (bufSurface) SDL_FreeSurface(bufSurface); + bufSurface = NULL; +#ifdef FILTERS + if (preSurface) SDL_FreeSurface(preSurface); + preSurface = NULL; + if (f2xSurface) SDL_FreeSurface(f2xSurface); + f2xSurface = NULL; +#endif + } + + // was graphics initialized anyway? + if (!graphics_started) + return; + CONS_Printf("I_ShutdownGraphics: "); +#ifdef _WIN32 + //ResetAero(); +#endif + graphics_started = false; + CONS_Printf("%s", M_GetText("shut down\n")); +#ifdef HWRENDER + if (GLUhandle) + hwClose(GLUhandle); +#endif +#ifndef _arch_dreamcast + SDL_QuitSubSystem(SDL_INIT_VIDEO); +#endif + framebuffer = SDL_FALSE; +} +#endif diff --git a/src/sdl12/macosx/English.lproj/InfoPlist.strings b/src/sdl12/macosx/English.lproj/InfoPlist.strings new file mode 100644 index 000000000..e69de29bb diff --git a/src/sdl12/macosx/Info.plist b/src/sdl12/macosx/Info.plist new file mode 100644 index 000000000..ae0ce24de --- /dev/null +++ b/src/sdl12/macosx/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + Srb2mac.icns + CFBundleIdentifier + com.yourcompany.Srb2mac + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + SDLMain + NSPrincipalClass + NSApplication + + diff --git a/src/sdl12/macosx/Srb2mac.icns b/src/sdl12/macosx/Srb2mac.icns new file mode 100644 index 000000000..4baedc1c5 Binary files /dev/null and b/src/sdl12/macosx/Srb2mac.icns differ diff --git a/src/sdl12/macosx/Srb2mac.pbproj/project.pbxproj b/src/sdl12/macosx/Srb2mac.pbproj/project.pbxproj new file mode 100644 index 000000000..de12201f5 --- /dev/null +++ b/src/sdl12/macosx/Srb2mac.pbproj/project.pbxproj @@ -0,0 +1,3546 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 38; + objects = { + 6726EB5E10190F860074DCBA = { + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 7; + files = ( + 6755C8D0101802C300A80195, + 6755C8D1101802C300A80195, + 6755C8D2101802C300A80195, + 6755C8D3101802C300A80195, + 6755C8D4101802C300A80195, + 6755C8D5101802C300A80195, + 6755C8D6101802C300A80195, + 6755C8D7101802C300A80195, + 6755C8D8101802C300A80195, + ); + isa = PBXCopyFilesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 6726EB5F10190FFC0074DCBA = { + buildActionMask = 2147483647; + files = ( + ); + generatedFileNames = ( + ); + isa = PBXShellScriptBuildPhase; + neededFileNames = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "touch -c $SRCROOT/../../comptime.c"; + }; + 6755C7A91017FE2500A80195 = { + fileEncoding = 30; + isa = PBXFileReference; + name = lzf.c; + path = ../../lzf.c; + refType = 2; + }; + 6755C7AA1017FE2500A80195 = { + fileEncoding = 30; + isa = PBXFileReference; + name = lzf.h; + path = ../../lzf.h; + refType = 2; + }; + 6755C7AB1017FE2500A80195 = { + fileEncoding = 30; + isa = PBXFileReference; + name = m_dllist.h; + path = ../../m_dllist.h; + refType = 2; + }; + 6755C7AC1017FE2500A80195 = { + fileEncoding = 30; + isa = PBXFileReference; + name = m_queue.c; + path = ../../m_queue.c; + refType = 2; + }; + 6755C7AD1017FE2500A80195 = { + fileEncoding = 30; + isa = PBXFileReference; + name = m_queue.h; + path = ../../m_queue.h; + refType = 2; + }; + 6755C7AE1017FE2500A80195 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_polyobj.c; + path = ../../p_polyobj.c; + refType = 2; + }; + 6755C7AF1017FE2500A80195 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_polyobj.h; + path = ../../p_polyobj.h; + refType = 2; + }; + 6755C7B11017FE2500A80195 = { + fileEncoding = 30; + isa = PBXFileReference; + name = string.c; + path = ../../string.c; + refType = 2; + }; + 6755C7B21017FE2500A80195 = { + fileRef = 6755C7A91017FE2500A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C7B31017FE2500A80195 = { + fileRef = 6755C7AA1017FE2500A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C7B51017FE2500A80195 = { + fileRef = 6755C7AC1017FE2500A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C7B71017FE2500A80195 = { + fileRef = 6755C7AE1017FE2500A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C7B81017FE2500A80195 = { + fileRef = 6755C7AF1017FE2500A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C7BB1017FE2500A80195 = { + fileRef = 6755C7A91017FE2500A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C7BC1017FE2500A80195 = { + fileRef = 6755C7AA1017FE2500A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C7BD1017FE2500A80195 = { + fileRef = 6755C7AB1017FE2500A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C7BE1017FE2500A80195 = { + fileRef = 6755C7AC1017FE2500A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C7BF1017FE2500A80195 = { + fileRef = 6755C7AD1017FE2500A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C7C01017FE2500A80195 = { + fileRef = 6755C7AE1017FE2500A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C7C11017FE2500A80195 = { + fileRef = 6755C7AF1017FE2500A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C7C41017FE4400A80195 = { + children = ( + 6755C7FA1017FE4500A80195, + 6755C7FB1017FE4500A80195, + ); + isa = PBXGroup; + name = macosx; + path = ""; + refType = 2; + }; + 6755C7FA1017FE4500A80195 = { + fileEncoding = 30; + isa = PBXFileReference; + path = mac_alert.c; + refType = 2; + }; + 6755C7FB1017FE4500A80195 = { + fileEncoding = 30; + isa = PBXFileReference; + path = mac_alert.h; + refType = 2; + }; + 6755C82A1017FE4500A80195 = { + fileEncoding = 30; + isa = PBXFileReference; + name = sdlmain.h; + path = ../sdlmain.h; + refType = 2; + }; + 6755C84B1017FE4500A80195 = { + fileRef = 6755C7FA1017FE4500A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C8651017FE4500A80195 = { + fileRef = 6755C82A1017FE4500A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C8861017FE4500A80195 = { + fileRef = 6755C7FA1017FE4500A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C8871017FE4500A80195 = { + fileRef = 6755C7FB1017FE4500A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C8A01017FE4500A80195 = { + fileRef = 6755C82A1017FE4500A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C8A41017FE8000A80195 = { + children = ( + 84177748085A1097000C01D8, + 84177749085A1097000C01D8, + 8417774A085A1097000C01D8, + 8417774B085A1097000C01D8, + 8417774C085A1097000C01D8, + 8417774D085A1097000C01D8, + 8417774E085A1097000C01D8, + 8417774F085A1097000C01D8, + 84177750085A1097000C01D8, + 84177751085A1097000C01D8, + 84177752085A1097000C01D8, + 84177753085A1097000C01D8, + 84177754085A1097000C01D8, + 84177755085A10AA000C01D8, + 84177756085A10AA000C01D8, + 6755C82A1017FE4500A80195, + 84177757085A10AA000C01D8, + 6755C7C41017FE4400A80195, + ); + isa = PBXGroup; + name = SDL; + path = ""; + refType = 2; + }; + 6755C8BE101802C300A80195 = { + isa = PBXFileReference; + name = drill.dta; + path = ../../../bin/Resources/drill.dta; + refType = 2; + }; + 6755C8BF101802C300A80195 = { + isa = PBXFileReference; + name = fmod.dll; + path = ../../../bin/Resources/fmod.dll; + refType = 2; + }; + 6755C8C0101802C300A80195 = { + isa = PBXFileReference; + name = knux.plr; + path = ../../../bin/Resources/knux.plr; + refType = 2; + }; + 6755C8C1101802C300A80195 = { + isa = PBXFileReference; + name = music.dta; + path = ../../../bin/Resources/music.dta; + refType = 2; + }; + 6755C8C2101802C300A80195 = { + isa = PBXFileReference; + name = rings.wpn; + path = ../../../bin/Resources/rings.wpn; + refType = 2; + }; + 6755C8C3101802C300A80195 = { + isa = PBXFileReference; + name = soar.dta; + path = ../../../bin/Resources/soar.dta; + refType = 2; + }; + 6755C8C4101802C300A80195 = { + isa = PBXFileReference; + name = sonic.plr; + path = ../../../bin/Resources/sonic.plr; + refType = 2; + }; + 6755C8C5101802C300A80195 = { + isa = PBXFileReference; + name = srb2.wad; + path = ../../../bin/Resources/srb2.wad; + refType = 2; + }; + 6755C8C6101802C300A80195 = { + isa = PBXFileReference; + name = tails.plr; + path = ../../../bin/Resources/tails.plr; + refType = 2; + }; + 6755C8C7101802C300A80195 = { + fileRef = 6755C8BE101802C300A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C8C8101802C300A80195 = { + fileRef = 6755C8BF101802C300A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C8C9101802C300A80195 = { + fileRef = 6755C8C0101802C300A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C8CA101802C300A80195 = { + fileRef = 6755C8C1101802C300A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C8CB101802C300A80195 = { + fileRef = 6755C8C2101802C300A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C8CC101802C300A80195 = { + fileRef = 6755C8C3101802C300A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C8CD101802C300A80195 = { + fileRef = 6755C8C4101802C300A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C8CE101802C300A80195 = { + fileRef = 6755C8C5101802C300A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C8CF101802C300A80195 = { + fileRef = 6755C8C6101802C300A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C8D0101802C300A80195 = { + fileRef = 6755C8BE101802C300A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C8D1101802C300A80195 = { + fileRef = 6755C8BF101802C300A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C8D2101802C300A80195 = { + fileRef = 6755C8C0101802C300A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C8D3101802C300A80195 = { + fileRef = 6755C8C1101802C300A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C8D4101802C300A80195 = { + fileRef = 6755C8C2101802C300A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C8D5101802C300A80195 = { + fileRef = 6755C8C3101802C300A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C8D6101802C300A80195 = { + fileRef = 6755C8C4101802C300A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C8D7101802C300A80195 = { + fileRef = 6755C8C5101802C300A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 6755C8D8101802C300A80195 = { + fileRef = 6755C8C6101802C300A80195; + isa = PBXBuildFile; + settings = { + }; + }; + 677B5EC810180D4E00A80195 = { + fileRef = 84177758085A10D2000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 677B5EC910180D6600A80195 = { + children = ( + 84177758085A10D2000C01D8, + ); + isa = PBXGroup; + name = r_opengl; + refType = 4; + }; + 677B5ECA10180D7100A80195 = { + children = ( + 84F202CA08A92AA0000C01D8, + ); + isa = PBXGroup; + name = s_openal; + refType = 4; + }; + 67B2D0C91018779900A80195 = { + fileRef = 84177748085A1097000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 67B2D0CA1018779D00A80195 = { + fileRef = 84177748085A1097000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; +//670 +//671 +//672 +//673 +//674 +//840 +//841 +//842 +//843 +//844 + 840CE6B009198AA7000C01D8 = { + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 840CE6B309198ABB000C01D8, + 840CE6B409198ABB000C01D8, + 849BD32D0A7E471D000C01D8, + ); + isa = PBXCopyFilesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 840CE6B309198ABB000C01D8 = { + fileRef = 84C4E04B08620A46000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 840CE6B409198ABB000C01D8 = { + fileRef = 84C4E04C08620A46000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 841776FE085A0C64000C01D8 = { + children = ( + 84C4E00D0862063C000C01D8, + 84177705085A0CDB000C01D8, + 84177706085A0D9D000C01D8, + 84177708085A0DB5000C01D8, + 84177709085A0DD1000C01D8, + 84177712085A0EB5000C01D8, + 8417770B085A0E17000C01D8, + 8417770C085A0E40000C01D8, + 8417770D085A0E4E000C01D8, + 8417770E085A0E5B000C01D8, + 8417770F085A0E66000C01D8, + 84177710085A0E71000C01D8, + 84177711085A0E77000C01D8, + 841779E2085A138F000C01D8, + 84F202C708A92A5D000C01D8, + 84C4E03F0862096F000C01D8, + 84C4E0420862098A000C01D8, + 84C4E045086209D3000C01D8, + 84C4E048086209FF000C01D8, + 84C4E04C08620A46000C01D8, + 84C4E04B08620A46000C01D8, + 849BD31C0A7E45B3000C01D8, + ); + isa = PBXGroup; + refType = 4; + }; + 84177700085A0C64000C01D8 = { + buildRules = ( + ); + buildSettings = { + COPY_PHASE_STRIP = NO; + }; + isa = PBXBuildStyle; + name = Development; + }; + 84177701085A0C64000C01D8 = { + buildRules = ( + ); + buildSettings = { + COPY_PHASE_STRIP = YES; + }; + isa = PBXBuildStyle; + name = Deployment; + }; + 84177702085A0C64000C01D8 = { + buildStyles = ( + 84177700085A0C64000C01D8, + 84177701085A0C64000C01D8, + ); + hasScannedForEncodings = 1; + isa = PBXProject; + mainGroup = 841776FE085A0C64000C01D8; + productRefGroup = 841779E2085A138F000C01D8; + projectDirPath = ""; + targets = ( + 841779E0085A138F000C01D8, + 841779E9085A13B1000C01D8, + ); + }; + 84177705085A0CDB000C01D8 = { + children = ( + 849603A80A791C11000C01D8, + 84177713085A0FCE000C01D8, + 84177714085A0FCE000C01D8, + 84177716085A0FCE000C01D8, + 84177717085A0FCE000C01D8, + 84177718085A0FCE000C01D8, + 84177719085A0FCE000C01D8, + 8417771A085A0FCE000C01D8, + 8417771B085A0FCE000C01D8, + 8417771C085A0FCE000C01D8, + 8417771D085A0FCE000C01D8, + 8417771E085A0FCE000C01D8, + 8417771F085A0FCE000C01D8, + 84177720085A0FCE000C01D8, + 84177721085A0FCE000C01D8, + 84177722085A0FCE000C01D8, + 84177723085A0FCE000C01D8, + 84177724085A0FF2000C01D8, + 84177725085A0FF2000C01D8, + 84177726085A0FF2000C01D8, + 84177727085A0FF2000C01D8, + 6755C7B11017FE2500A80195, + ); + isa = PBXGroup; + name = D_SRB2; + path = ""; + refType = 2; + }; + 84177706085A0D9D000C01D8 = { + children = ( + 8417772A085A100E000C01D8, + 8417772B085A100E000C01D8, + 8417772C085A100E000C01D8, + ); + isa = PBXGroup; + name = F_Frame; + path = ""; + refType = 2; + }; + 84177708085A0DB5000C01D8 = { + children = ( + 841779DA085A1347000C01D8, + 841778C6085A1295000C01D8, + 841778C4085A1295000C01D8, + 841778C5085A1295000C01D8, + 8417772D085A1029000C01D8, + 8417772E085A1029000C01D8, + 8417772F085A1029000C01D8, + 84177730085A1029000C01D8, + 84177731085A1029000C01D8, + 841779D4085A1296000C01D8, + 841779D5085A1296000C01D8, + ); + isa = PBXGroup; + name = G_Game; + path = ""; + refType = 2; + }; + 84177709085A0DD1000C01D8 = { + children = ( + 841778BE085A1295000C01D8, + 841778BF085A1295000C01D8, + 841778C2085A1295000C01D8, + 841778C3085A1295000C01D8, + 841778C0085A1295000C01D8, + 841778C1085A1295000C01D8, + 84177732085A1040000C01D8, + 84177733085A1040000C01D8, + 841779D2085A1296000C01D8, + 841779D3085A1296000C01D8, + 841779D8085A1296000C01D8, + 8490D433085DF537000C01D8, + ); + isa = PBXGroup; + name = H_Hud; + path = ""; + refType = 2; + }; + 8417770B085A0E17000C01D8 = { + children = ( + 6755C8A41017FE8000A80195, + 84177759085A10D2000C01D8, + 841777A4085A1200000C01D8, + 841777A5085A1200000C01D8, + 841777A6085A1200000C01D8, + 841777A8085A1200000C01D8, + 841777A9085A1200000C01D8, + 841777AA085A1200000C01D8, + 841777AB085A1200000C01D8, + 841777AC085A1200000C01D8, + 841777AD085A1200000C01D8, + 841777AE085A1200000C01D8, + ); + isa = PBXGroup; + name = I_Interface; + path = ""; + refType = 2; + }; + 8417770C085A0E40000C01D8 = { + children = ( + 8417775A085A10EB000C01D8, + 8417775B085A10EB000C01D8, + 8417775C085A10EB000C01D8, + 8417775D085A10EB000C01D8, + 8417775E085A10EB000C01D8, + 8417775F085A10EB000C01D8, + 6755C7AB1017FE2500A80195, + 84177760085A10EB000C01D8, + 84177761085A10EB000C01D8, + 84177762085A10EB000C01D8, + 84177763085A10EB000C01D8, + 84177764085A10EB000C01D8, + 84177765085A10EB000C01D8, + 6755C7AC1017FE2500A80195, + 6755C7AD1017FE2500A80195, + 84177766085A10EB000C01D8, + 84177767085A10EB000C01D8, + 84177768085A10EB000C01D8, + ); + isa = PBXGroup; + name = M_Misc; + path = ""; + refType = 2; + }; + 8417770D085A0E4E000C01D8 = { + children = ( + 84177769085A1104000C01D8, + 8417776A085A1104000C01D8, + 8417776B085A1104000C01D8, + 8417776C085A1104000C01D8, + 8417776D085A1104000C01D8, + 8417776E085A1104000C01D8, + 8417776F085A1104000C01D8, + 84177770085A1104000C01D8, + 84177771085A1104000C01D8, + 84177772085A1104000C01D8, + 84177773085A1104000C01D8, + 84177774085A1104000C01D8, + 6755C7AE1017FE2500A80195, + 6755C7AF1017FE2500A80195, + 84177775085A1104000C01D8, + 84177776085A1104000C01D8, + 84177777085A1104000C01D8, + 84177778085A1104000C01D8, + 84177779085A1104000C01D8, + 8417777A085A1104000C01D8, + 8417777B085A1104000C01D8, + 8417777C085A1104000C01D8, + 8417777D085A1104000C01D8, + 8417777E085A1104000C01D8, + 8417777F085A1104000C01D8, + 84177780085A1104000C01D8, + ); + isa = PBXGroup; + name = P_Play; + path = ""; + refType = 2; + }; + 8417770E085A0E5B000C01D8 = { + children = ( + 84177781085A111B000C01D8, + 84177782085A111B000C01D8, + 84177783085A111B000C01D8, + 84177784085A111B000C01D8, + 84177785085A111B000C01D8, + 84177786085A111B000C01D8, + 84177787085A111B000C01D8, + 84177788085A111B000C01D8, + 84177789085A111B000C01D8, + 8417778A085A111B000C01D8, + 8417778B085A111B000C01D8, + 8417778C085A111B000C01D8, + 8417778D085A111B000C01D8, + 8417778E085A111B000C01D8, + 8417778F085A111B000C01D8, + 84177790085A111B000C01D8, + 84177791085A111B000C01D8, + 84177792085A111B000C01D8, + 84177793085A111B000C01D8, + 84177794085A111B000C01D8, + 84177795085A111B000C01D8, + 84177796085A111B000C01D8, + 84177797085A111B000C01D8, + 841777A2085A1197000C01D8, + 841777A3085A1197000C01D8, + 8490D436085DF57B000C01D8, + 841779D7085A1296000C01D8, + ); + isa = PBXGroup; + name = R_Rend; + path = ""; + refType = 2; + }; + 8417770F085A0E66000C01D8 = { + children = ( + 84177798085A1138000C01D8, + 84177799085A1138000C01D8, + 8417779A085A1138000C01D8, + 8417779B085A1138000C01D8, + ); + isa = PBXGroup; + name = S_Sounds; + path = ""; + refType = 2; + }; + 84177710085A0E71000C01D8 = { + children = ( + 8417779C085A114C000C01D8, + 8417779D085A114C000C01D8, + 8417779E085A116B000C01D8, + 8417779F085A116B000C01D8, + ); + isa = PBXGroup; + name = SDL_main; + path = ""; + refType = 2; + }; + 84177711085A0E77000C01D8 = { + children = ( + 6755C7A91017FE2500A80195, + 6755C7AA1017FE2500A80195, + 841777AF085A1228000C01D8, + 841777B0085A1228000C01D8, + 841777A0085A117F000C01D8, + 841777A1085A117F000C01D8, + 841778BC085A122A000C01D8, + 841778BD085A122A000C01D8, + ); + isa = PBXGroup; + name = W_Wad; + path = ""; + refType = 2; + }; + 84177712085A0EB5000C01D8 = { + children = ( + 677B5EC910180D6600A80195, + 677B5ECA10180D7100A80195, + 84177734085A106C000C01D8, + 84177735085A106C000C01D8, + 84177736085A106C000C01D8, + 84177737085A106C000C01D8, + 84177738085A106C000C01D8, + 84177739085A106C000C01D8, + 8417773A085A106C000C01D8, + 8417773B085A106C000C01D8, + 8417773C085A106C000C01D8, + 8417773D085A106C000C01D8, + 8417773E085A106C000C01D8, + 8417773F085A106C000C01D8, + 84177740085A106C000C01D8, + 84177741085A106C000C01D8, + 84177742085A106C000C01D8, + 84177743085A106C000C01D8, + 84177744085A106C000C01D8, + 84177745085A106C000C01D8, + 84177746085A106C000C01D8, + 84177747085A106C000C01D8, + ); + isa = PBXGroup; + name = Hw_Hardware; + path = ""; + refType = 2; + }; + 84177713085A0FCE000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = d_clisrv.c; + path = ../../d_clisrv.c; + refType = 2; + }; + 84177714085A0FCE000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = d_clisrv.h; + path = ../../d_clisrv.h; + refType = 2; + }; + 84177716085A0FCE000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = d_event.h; + path = ../../d_event.h; + refType = 2; + }; + 84177717085A0FCE000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = d_main.c; + path = ../../d_main.c; + refType = 2; + }; + 84177718085A0FCE000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = d_main.h; + path = ../../d_main.h; + refType = 2; + }; + 84177719085A0FCE000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = d_net.c; + path = ../../d_net.c; + refType = 2; + }; + 8417771A085A0FCE000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = d_net.h; + path = ../../d_net.h; + refType = 2; + }; + 8417771B085A0FCE000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = d_netcmd.c; + path = ../../d_netcmd.c; + refType = 2; + }; + 8417771C085A0FCE000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = d_netcmd.h; + path = ../../d_netcmd.h; + refType = 2; + }; + 8417771D085A0FCE000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = d_netfil.c; + path = ../../d_netfil.c; + refType = 2; + }; + 8417771E085A0FCE000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = d_netfil.h; + path = ../../d_netfil.h; + refType = 2; + }; + 8417771F085A0FCE000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = d_player.h; + path = ../../d_player.h; + refType = 2; + }; + 84177720085A0FCE000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = d_think.h; + path = ../../d_think.h; + refType = 2; + }; + 84177721085A0FCE000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = d_ticcmd.h; + path = ../../d_ticcmd.h; + refType = 2; + }; + 84177722085A0FCE000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = dehacked.c; + path = ../../dehacked.c; + refType = 2; + }; + 84177723085A0FCE000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = dehacked.h; + path = ../../dehacked.h; + refType = 2; + }; + 84177724085A0FF2000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = doomdata.h; + path = ../../doomdata.h; + refType = 2; + }; + 84177725085A0FF2000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = doomdef.h; + path = ../../doomdef.h; + refType = 2; + }; + 84177726085A0FF2000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = doomstat.h; + path = ../../doomstat.h; + refType = 2; + }; + 84177727085A0FF2000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = doomtype.h; + path = ../../doomtype.h; + refType = 2; + }; + 8417772A085A100E000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = f_finale.c; + path = ../../f_finale.c; + refType = 2; + }; + 8417772B085A100E000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = f_finale.h; + path = ../../f_finale.h; + refType = 2; + }; + 8417772C085A100E000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = f_wipe.c; + path = ../../f_wipe.c; + refType = 2; + }; + 8417772D085A1029000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = g_game.c; + path = ../../g_game.c; + refType = 2; + }; + 8417772E085A1029000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = g_game.h; + path = ../../g_game.h; + refType = 2; + }; + 8417772F085A1029000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = g_input.c; + path = ../../g_input.c; + refType = 2; + }; + 84177730085A1029000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = g_input.h; + path = ../../g_input.h; + refType = 2; + }; + 84177731085A1029000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = g_state.h; + path = ../../g_state.h; + refType = 2; + }; + 84177732085A1040000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hu_stuff.c; + path = ../../hu_stuff.c; + refType = 2; + }; + 84177733085A1040000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hu_stuff.h; + path = ../../hu_stuff.h; + refType = 2; + }; + 84177734085A106C000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hw_bsp.c; + path = ../../hardware/hw_bsp.c; + refType = 2; + }; + 84177735085A106C000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hw_cache.c; + path = ../../hardware/hw_cache.c; + refType = 2; + }; + 84177736085A106C000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hw_data.h; + path = ../../hardware/hw_data.h; + refType = 2; + }; + 84177737085A106C000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hw_defs.h; + path = ../../hardware/hw_defs.h; + refType = 2; + }; + 84177738085A106C000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hw_dll.h; + path = ../../hardware/hw_dll.h; + refType = 2; + }; + 84177739085A106C000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hw_draw.c; + path = ../../hardware/hw_draw.c; + refType = 2; + }; + 8417773A085A106C000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hw_drv.h; + path = ../../hardware/hw_drv.h; + refType = 2; + }; + 8417773B085A106C000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hw_glide.h; + path = ../../hardware/hw_glide.h; + refType = 2; + }; + 8417773C085A106C000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hw_glob.h; + path = ../../hardware/hw_glob.h; + refType = 2; + }; + 8417773D085A106C000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hw_light.c; + path = ../../hardware/hw_light.c; + refType = 2; + }; + 8417773E085A106C000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hw_light.h; + path = ../../hardware/hw_light.h; + refType = 2; + }; + 8417773F085A106C000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hw_main.c; + path = ../../hardware/hw_main.c; + refType = 2; + }; + 84177740085A106C000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hw_main.h; + path = ../../hardware/hw_main.h; + refType = 2; + }; + 84177741085A106C000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hw_md2.c; + path = ../../hardware/hw_md2.c; + refType = 2; + }; + 84177742085A106C000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hw_md2.h; + path = ../../hardware/hw_md2.h; + refType = 2; + }; + 84177743085A106C000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hw_trick.c; + path = ../../hardware/hw_trick.c; + refType = 2; + }; + 84177744085A106C000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hw3dsdrv.h; + path = ../../hardware/hw3dsdrv.h; + refType = 2; + }; + 84177745085A106C000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hw3sound.c; + path = ../../hardware/hw3sound.c; + refType = 2; + }; + 84177746085A106C000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hw3sound.h; + path = ../../hardware/hw3sound.h; + refType = 2; + }; + 84177747085A106C000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hws_data.h; + path = ../../hardware/hws_data.h; + refType = 2; + }; + 84177748085A1097000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = dosstr.c; + path = ../dosstr.c; + refType = 2; + }; + 84177749085A1097000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = endtxt.c; + path = ../endtxt.c; + refType = 2; + }; + 8417774A085A1097000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = endtxt.h; + path = ../endtxt.h; + refType = 2; + }; + 8417774B085A1097000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = filesrch.c; + path = ../../filesrch.c; + refType = 2; + }; + 8417774C085A1097000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hwsym_sdl.c; + path = ../hwsym_sdl.c; + refType = 2; + }; + 8417774D085A1097000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = hwsym_sdl.h; + path = ../hwsym_sdl.h; + refType = 2; + }; + 8417774E085A1097000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = i_cdmus.c; + path = ../i_cdmus.c; + refType = 2; + }; + 8417774F085A1097000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = i_main.c; + path = ../i_main.c; + refType = 2; + }; + 84177750085A1097000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = i_net.c; + path = ../i_net.c; + refType = 2; + }; + 84177751085A1097000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = i_sound.c; + path = ../i_sound.c; + refType = 2; + }; + 84177752085A1097000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = i_system.c; + path = ../i_system.c; + refType = 2; + }; + 84177753085A1097000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = i_video.c; + path = ../i_video.c; + refType = 2; + }; + 84177754085A1097000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = IMG_xpm.c; + path = ../IMG_xpm.c; + refType = 2; + }; + 84177755085A10AA000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = ogl_sdl.c; + path = ../ogl_sdl.c; + refType = 2; + }; + 84177756085A10AA000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = ogl_sdl.h; + path = ../ogl_sdl.h; + refType = 2; + }; + 84177757085A10AA000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = SDL_icon.xpm; + path = ../SDL_icon.xpm; + refType = 2; + }; + 84177758085A10D2000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_opengl.c; + path = ../../hardware/r_opengl/r_opengl.c; + refType = 2; + }; + 84177759085A10D2000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_opengl.h; + path = ../../hardware/r_opengl/r_opengl.h; + refType = 2; + }; + 8417775A085A10EB000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = m_argv.c; + path = ../../m_argv.c; + refType = 2; + }; + 8417775B085A10EB000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = m_argv.h; + path = ../../m_argv.h; + refType = 2; + }; + 8417775C085A10EB000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = m_bbox.c; + path = ../../m_bbox.c; + refType = 2; + }; + 8417775D085A10EB000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = m_bbox.h; + path = ../../m_bbox.h; + refType = 2; + }; + 8417775E085A10EB000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = m_cheat.c; + path = ../../m_cheat.c; + refType = 2; + }; + 8417775F085A10EB000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = m_cheat.h; + path = ../../m_cheat.h; + refType = 2; + }; + 84177760085A10EB000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = m_fixed.c; + path = ../../m_fixed.c; + refType = 2; + }; + 84177761085A10EB000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = m_fixed.h; + path = ../../m_fixed.h; + refType = 2; + }; + 84177762085A10EB000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = m_menu.c; + path = ../../m_menu.c; + refType = 2; + }; + 84177763085A10EB000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = m_menu.h; + path = ../../m_menu.h; + refType = 2; + }; + 84177764085A10EB000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = m_misc.c; + path = ../../m_misc.c; + refType = 2; + }; + 84177765085A10EB000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = m_misc.h; + path = ../../m_misc.h; + refType = 2; + }; + 84177766085A10EB000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = m_random.c; + path = ../../m_random.c; + refType = 2; + }; + 84177767085A10EB000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = m_random.h; + path = ../../m_random.h; + refType = 2; + }; + 84177768085A10EB000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = m_swap.h; + path = ../../m_swap.h; + refType = 2; + }; + 84177769085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_ceilng.c; + path = ../../p_ceilng.c; + refType = 2; + }; + 8417776A085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_enemy.c; + path = ../../p_enemy.c; + refType = 2; + }; + 8417776B085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_fab.c; + path = ../../p_fab.c; + refType = 2; + }; + 8417776C085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_floor.c; + path = ../../p_floor.c; + refType = 2; + }; + 8417776D085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_inter.c; + path = ../../p_inter.c; + refType = 2; + }; + 8417776E085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_lights.c; + path = ../../p_lights.c; + refType = 2; + }; + 8417776F085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_local.h; + path = ../../p_local.h; + refType = 2; + }; + 84177770085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_map.c; + path = ../../p_map.c; + refType = 2; + }; + 84177771085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_maputl.c; + path = ../../p_maputl.c; + refType = 2; + }; + 84177772085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_maputl.h; + path = ../../p_maputl.h; + refType = 2; + }; + 84177773085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_mobj.c; + path = ../../p_mobj.c; + refType = 2; + }; + 84177774085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_mobj.h; + path = ../../p_mobj.h; + refType = 2; + }; + 84177775085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_pspr.h; + path = ../../p_pspr.h; + refType = 2; + }; + 84177776085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_saveg.c; + path = ../../p_saveg.c; + refType = 2; + }; + 84177777085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_saveg.h; + path = ../../p_saveg.h; + refType = 2; + }; + 84177778085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_setup.c; + path = ../../p_setup.c; + refType = 2; + }; + 84177779085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_setup.h; + path = ../../p_setup.h; + refType = 2; + }; + 8417777A085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_sight.c; + path = ../../p_sight.c; + refType = 2; + }; + 8417777B085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_spec.c; + path = ../../p_spec.c; + refType = 2; + }; + 8417777C085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_spec.h; + path = ../../p_spec.h; + refType = 2; + }; + 8417777D085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_telept.c; + path = ../../p_telept.c; + refType = 2; + }; + 8417777E085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_tick.c; + path = ../../p_tick.c; + refType = 2; + }; + 8417777F085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_tick.h; + path = ../../p_tick.h; + refType = 2; + }; + 84177780085A1104000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = p_user.c; + path = ../../p_user.c; + refType = 2; + }; + 84177781085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_bsp.c; + path = ../../r_bsp.c; + refType = 2; + }; + 84177782085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_bsp.h; + path = ../../r_bsp.h; + refType = 2; + }; + 84177783085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_data.c; + path = ../../r_data.c; + refType = 2; + }; + 84177784085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_data.h; + path = ../../r_data.h; + refType = 2; + }; + 84177785085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_defs.h; + path = ../../r_defs.h; + refType = 2; + }; + 84177786085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_draw.c; + path = ../../r_draw.c; + refType = 2; + }; + 84177787085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_draw.h; + path = ../../r_draw.h; + refType = 2; + }; + 84177788085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_draw8.c; + path = ../../r_draw8.c; + refType = 2; + }; + 84177789085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_draw16.c; + path = ../../r_draw16.c; + refType = 2; + }; + 8417778A085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_local.h; + path = ../../r_local.h; + refType = 2; + }; + 8417778B085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_main.c; + path = ../../r_main.c; + refType = 2; + }; + 8417778C085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_main.h; + path = ../../r_main.h; + refType = 2; + }; + 8417778D085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_plane.c; + path = ../../r_plane.c; + refType = 2; + }; + 8417778E085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_plane.h; + path = ../../r_plane.h; + refType = 2; + }; + 8417778F085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_segs.c; + path = ../../r_segs.c; + refType = 2; + }; + 84177790085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_segs.h; + path = ../../r_segs.h; + refType = 2; + }; + 84177791085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_sky.c; + path = ../../r_sky.c; + refType = 2; + }; + 84177792085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_sky.h; + path = ../../r_sky.h; + refType = 2; + }; + 84177793085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_splats.c; + path = ../../r_splats.c; + refType = 2; + }; + 84177794085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_splats.h; + path = ../../r_splats.h; + refType = 2; + }; + 84177795085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_state.h; + path = ../../r_state.h; + refType = 2; + }; + 84177796085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_things.c; + path = ../../r_things.c; + refType = 2; + }; + 84177797085A111B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = r_things.h; + path = ../../r_things.h; + refType = 2; + }; + 84177798085A1138000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = s_sound.c; + path = ../../s_sound.c; + refType = 2; + }; + 84177799085A1138000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = s_sound.h; + path = ../../s_sound.h; + refType = 2; + }; + 8417779A085A1138000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = sounds.c; + path = ../../sounds.c; + refType = 2; + }; + 8417779B085A1138000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = sounds.h; + path = ../../sounds.h; + refType = 2; + }; + 8417779C085A114C000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + path = mac_alert.c; + refType = 2; + }; + 8417779D085A114C000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + path = mac_alert.h; + refType = 2; + }; + 8417779E085A116B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = SDL_macosx_main.h; + path = ../SDL_main/SDL_macosx_main.h; + refType = 2; + }; + 8417779F085A116B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = SDL_macosx_main.m; + path = ../SDL_main/SDL_macosx_main.m; + refType = 2; + }; + 841777A0085A117F000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = w_wad.c; + path = ../../w_wad.c; + refType = 2; + }; + 841777A1085A117F000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = w_wad.h; + path = ../../w_wad.h; + refType = 2; + }; + 841777A2085A1197000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = screen.c; + path = ../../screen.c; + refType = 2; + }; + 841777A3085A1197000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = screen.h; + path = ../../screen.h; + refType = 2; + }; + 841777A4085A1200000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = filesrch.h; + path = ../../filesrch.h; + refType = 2; + }; + 841777A5085A1200000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = i_joy.h; + path = ../../i_joy.h; + refType = 2; + }; + 841777A6085A1200000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = i_net.h; + path = ../../i_net.h; + refType = 2; + }; + 841777A8085A1200000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = i_sound.h; + path = ../../i_sound.h; + refType = 2; + }; + 841777A9085A1200000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = i_system.h; + path = ../../i_system.h; + refType = 2; + }; + 841777AA085A1200000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = i_tcp.c; + path = ../../i_tcp.c; + refType = 2; + }; + 841777AB085A1200000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = i_tcp.h; + path = ../../i_tcp.h; + refType = 2; + }; + 841777AC085A1200000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = i_video.h; + path = ../../i_video.h; + refType = 2; + }; + 841777AD085A1200000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = mserv.c; + path = ../../mserv.c; + refType = 2; + }; + 841777AE085A1200000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = mserv.h; + path = ../../mserv.h; + refType = 2; + }; + 841777AF085A1228000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = md5.c; + path = ../../md5.c; + refType = 2; + }; + 841777B0085A1228000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = md5.h; + path = ../../md5.h; + refType = 2; + }; + 841778BC085A122A000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = z_zone.c; + path = ../../z_zone.c; + refType = 2; + }; + 841778BD085A122A000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = z_zone.h; + path = ../../z_zone.h; + refType = 2; + }; + 841778BE085A1295000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = am_map.c; + path = ../../am_map.c; + refType = 2; + }; + 841778BF085A1295000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = am_map.h; + path = ../../am_map.h; + refType = 2; + }; + 841778C0085A1295000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = command.c; + path = ../../command.c; + refType = 2; + }; + 841778C1085A1295000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = command.h; + path = ../../command.h; + refType = 2; + }; + 841778C2085A1295000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = console.c; + path = ../../console.c; + refType = 2; + }; + 841778C3085A1295000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = console.h; + path = ../../console.h; + refType = 2; + }; + 841778C4085A1295000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = info.c; + path = ../../info.c; + refType = 2; + }; + 841778C5085A1295000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = info.h; + path = ../../info.h; + refType = 2; + }; + 841778C6085A1295000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = keys.h; + path = ../../keys.h; + refType = 2; + }; + 841779D2085A1296000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = st_stuff.c; + path = ../../st_stuff.c; + refType = 2; + }; + 841779D3085A1296000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = st_stuff.h; + path = ../../st_stuff.h; + refType = 2; + }; + 841779D4085A1296000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = tables.c; + path = ../../tables.c; + refType = 2; + }; + 841779D5085A1296000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = tables.h; + path = ../../tables.h; + refType = 2; + }; + 841779D7085A1296000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = v_video.h; + path = ../../v_video.h; + refType = 2; + }; + 841779D8085A1296000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = y_inter.c; + path = ../../y_inter.c; + refType = 2; + }; + 841779DA085A1347000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = byteptr.h; + path = ../../byteptr.h; + refType = 2; + }; + 841779DC085A138F000C01D8 = { + buildActionMask = 2147483647; + files = ( + 6755C8C7101802C300A80195, + 6755C8C8101802C300A80195, + 6755C8C9101802C300A80195, + 6755C8CA101802C300A80195, + 6755C8CB101802C300A80195, + 6755C8CC101802C300A80195, + 6755C8CD101802C300A80195, + 6755C8CE101802C300A80195, + 6755C8CF101802C300A80195, + ); + isa = PBXResourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 841779DD085A138F000C01D8 = { + buildActionMask = 2147483647; + files = ( + 84177A2A085A18A8000C01D8, + 84177A2E085A18D2000C01D8, + 84177A30085A18D3000C01D8, + 84177A32085A18D4000C01D8, + 84177A34085A18D5000C01D8, + 84177A39085A18D8000C01D8, + 84177A3F085A18DC000C01D8, + 84177A41085A18E0000C01D8, + 84177A43085A18E1000C01D8, + 84177A46085A18E8000C01D8, + 84177A4A085A18EA000C01D8, + 84177A4E085A18EC000C01D8, + 84177A50085A18F2000C01D8, + 84177A52085A193F000C01D8, + 84177A53085A1940000C01D8, + 84177A54085A1942000C01D8, + 84177A55085A1943000C01D8, + 84177A56085A195A000C01D8, + 84177A57085A195B000C01D8, + 84177A58085A1968000C01D8, + 84177A59085A1969000C01D8, + 84177A5A085A196B000C01D8, + 84177A5B085A197A000C01D8, + 84177A5C085A197C000C01D8, + 84177A5D085A197D000C01D8, + 84177A5E085A197E000C01D8, + 84177A5F085A1980000C01D8, + 84177A61085A1985000C01D8, + 84177A62085A1986000C01D8, + 84177A63085A1988000C01D8, + 84177A64085A1989000C01D8, + 84177A65085A198A000C01D8, + 84177A66085A198A000C01D8, + 84177A67085A198B000C01D8, + 84177A68085A198C000C01D8, + 84177A69085A198E000C01D8, + 84177A6B085A1994000C01D8, + 84177A6C085A1995000C01D8, + 84177A6D085A199D000C01D8, + 84177A6E085A19A0000C01D8, + 84177A6F085A19A1000C01D8, + 84177A70085A19A2000C01D8, + 84177A71085A19A4000C01D8, + 84177A72085A19A5000C01D8, + 84177A73085A19A6000C01D8, + 84177A74085A19A7000C01D8, + 84177A75085A19AC000C01D8, + 84177A76085A19AD000C01D8, + 84177A77085A19AE000C01D8, + 84177A78085A19AE000C01D8, + 84177A79085A19AF000C01D8, + 84177A7A085A19B0000C01D8, + 84177A7B085A19B3000C01D8, + 84177A7C085A19B4000C01D8, + 84177A7D085A19B5000C01D8, + 84177A7E085A19B7000C01D8, + 84177A7F085A19B8000C01D8, + 84177A80085A19B9000C01D8, + 84177A81085A19BA000C01D8, + 84177A82085A19BB000C01D8, + 84177A83085A19BB000C01D8, + 84177A84085A19BC000C01D8, + 84177A85085A19C1000C01D8, + 84177A86085A19C2000C01D8, + 84177A87085A19C3000C01D8, + 84177A88085A19C6000C01D8, + 84177A89085A19C7000C01D8, + 84177A8A085A19C9000C01D8, + 84177A8B085A19CC000C01D8, + 84177A8C085A19CD000C01D8, + 84177A8D085A19CF000C01D8, + 84177A8E085A19D0000C01D8, + 84177A90085A19D8000C01D8, + 84177A91085A19D9000C01D8, + 84177A92085A19DD000C01D8, + 84177A93085A19DF000C01D8, + 84177A94085A19E1000C01D8, + 84177A95085A19E3000C01D8, + 84177A96085A19E6000C01D8, + 8490D438085DF57B000C01D8, + 849603AA0A791C11000C01D8, + 6755C7B21017FE2500A80195, + 6755C7B31017FE2500A80195, + 6755C7B51017FE2500A80195, + 6755C7B71017FE2500A80195, + 6755C7B81017FE2500A80195, + 6755C84B1017FE4500A80195, + 6755C8651017FE4500A80195, + 677B5EC810180D4E00A80195, + 67B2D0C91018779900A80195, + ); + isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 841779DE085A138F000C01D8 = { + buildActionMask = 2147483647; + files = ( + 84C4E0410862096F000C01D8, + 84C4E0440862098A000C01D8, + 84C4E047086209D3000C01D8, + 84C4E04A086209FF000C01D8, + 84C4E04F08620A46000C01D8, + 84C4E05008620A46000C01D8, + 849BD31E0A7E45B3000C01D8, + ); + isa = PBXFrameworksBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 841779E0085A138F000C01D8 = { + buildPhases = ( + 841779DC085A138F000C01D8, + 841779DD085A138F000C01D8, + 841779DE085A138F000C01D8, + ); + buildSettings = { + DEBUGGING_SYMBOLS = NO; + FRAMEWORK_SEARCH_PATHS = "\"$(LOCAL_LIBRARY_DIR)/Frameworks\""; + HEADER_SEARCH_PATHS = "\"$(LOCAL_LIBRARY_DIR)/Frameworks/SDL.framework/Headers\" \"$(LOCAL_LIBRARY_DIR)/Frameworks/SDL_mixer.framework/Headers\" \"$(LOCAL_LIBRARY_DIR)/Frameworks/OpenAL.framework/Headers\" \"$(LOCAL_LIBRARY_DIR)/Frameworks/libpng.framework/Headers\""; + INSTALL_PATH = "$(HOME)/Applications"; + JAVA_COMPILER_DEBUGGING_SYMBOLS = NO; + OPTIMIZATION_CFLAGS = "-O2"; + OTHER_CFLAGS = "-DMAC_ALERT -DUNIXCOMMON -DSDLMAIN -DHAVE_MIXER -DHAVE_PNG -D_BIG_ENDIAN -DSTDC_HEADERS -DSDL -Wall -Winline -fno-strict-aliasing"; + OTHER_REZFLAGS = ""; + PREBINDING = NO; + PRODUCT_NAME = Srb2; + SECTORDER_FLAGS = ""; + USE_GCC3_PFE_SUPPORT = NO; + WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas -Wno-long-double"; + WRAPPER_EXTENSION = app; + }; + dependencies = ( + ); + isa = PBXApplicationTarget; + name = Srb2; + productInstallPath = "$(HOME)/Applications"; + productName = Srb2; + productReference = 841779E1085A138F000C01D8; + productSettingsXML = " + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + Srb2 + CFBundleGetInfoString + + CFBundleIconFile + Srb2mac + CFBundleIdentifier + + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Sonic Robo Blast 2 + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.09 + CFBundleSignature + ???? + CFBundleVersion + 1.09 + NSMainNibFile + SDL_Main.nib + NSPrincipalClass + NSApplication + + +"; + }; + 841779E1085A138F000C01D8 = { + isa = PBXApplicationReference; + path = Srb2.app; + refType = 3; + }; + 841779E2085A138F000C01D8 = { + children = ( + 841779E1085A138F000C01D8, + 841779EA085A13B1000C01D8, + ); + isa = PBXGroup; + name = Products; + refType = 4; + }; + 841779E6085A13B1000C01D8 = { + buildActionMask = 2147483647; + files = ( + 84177A98085A1A0B000C01D8, + 84177A99085A1A0E000C01D8, + 84177A9A085A1A0F000C01D8, + 84177A9B085A1A11000C01D8, + 84177A9C085A1A12000C01D8, + 84177A9D085A1A14000C01D8, + 84177A9E085A1A16000C01D8, + 84177A9F085A1A1E000C01D8, + 84177AA0085A1A1F000C01D8, + 84177AA1085A1A24000C01D8, + 84177AA2085A1A25000C01D8, + 84177AA3085A1A27000C01D8, + 84177AA4085A1A28000C01D8, + 84177AA5085A1A2B000C01D8, + 84177AA6085A1A2C000C01D8, + 84177AA7085A1A2D000C01D8, + 84177AA8085A1A2F000C01D8, + 84177AA9085A1A30000C01D8, + 84177AAA085A1A31000C01D8, + 84177AB4085A1A5E000C01D8, + 84177AB5085A1A60000C01D8, + 84177AB8085A1A65000C01D8, + 84177AB9085A1A65000C01D8, + 84177ABA085A1A66000C01D8, + 84177ABB085A1A67000C01D8, + 84177ABC085A1A67000C01D8, + 84177ABD085A1A68000C01D8, + 84177AC1085A1A70000C01D8, + 84177AC2085A1A72000C01D8, + 84177AC3085A1A77000C01D8, + 84177AC4085A1A78000C01D8, + 84177AC5085A1A7A000C01D8, + 84177AC6085A1A7B000C01D8, + 84177AC7085A1A7C000C01D8, + 84177AC8085A1A7D000C01D8, + 84177AC9085A1A7F000C01D8, + 84177ACA085A1A87000C01D8, + 84177ACB085A1A88000C01D8, + 84177ACC085A1A88000C01D8, + 84177ACD085A1A89000C01D8, + 84177ACE085A1A8A000C01D8, + 84177ACF085A1A8B000C01D8, + 84177AD0085A1A8C000C01D8, + 84177AD1085A1A8D000C01D8, + 84177AD2085A1A90000C01D8, + 84177AD4085A1A92000C01D8, + 84177AD5085A1A93000C01D8, + 84177AD6085A1A94000C01D8, + 84177AD7085A1A97000C01D8, + 84177AD8085A1A97000C01D8, + 84177AD9085A1A99000C01D8, + 84177ADA085A1A9F000C01D8, + 84177ADB085A1AA0000C01D8, + 84177ADC085A1AA2000C01D8, + 84177ADF085A1AA4000C01D8, + 84177AE0085A1AA6000C01D8, + 84177AE1085A1AA7000C01D8, + 84177AE2085A1AA8000C01D8, + 84177AE3085A1AA9000C01D8, + 84177AE4085A1AAA000C01D8, + 84177AE5085A1AAE000C01D8, + 84177AE7085A1AB5000C01D8, + 84177AE8085A1AB6000C01D8, + 84177AEB085A1ABD000C01D8, + 84177AEC085A1ABF000C01D8, + 84177AED085A1ABF000C01D8, + 8490D432085DF3D6000C01D8, + 8490D437085DF57B000C01D8, + 8490D43C085E0518000C01D8, + 8490D43D085E05F6000C01D8, + 8490D43E085E05F7000C01D8, + 8490D43F085E05F8000C01D8, + 8490D440085E05FA000C01D8, + 8490D441085E05FB000C01D8, + 8490D442085E05FC000C01D8, + 8490D443085E05FE000C01D8, + 8490D444085E05FF000C01D8, + 8490D445085E0606000C01D8, + 8490D446085E060A000C01D8, + 8490D447085E060B000C01D8, + 8490D448085E067E000C01D8, + 849603A90A791C11000C01D8, + 6755C7BB1017FE2500A80195, + 6755C7BC1017FE2500A80195, + 6755C7BD1017FE2500A80195, + 6755C7BE1017FE2500A80195, + 6755C7BF1017FE2500A80195, + 6755C7C01017FE2500A80195, + 6755C7C11017FE2500A80195, + 6755C8861017FE4500A80195, + 6755C8871017FE4500A80195, + 6755C8A01017FE4500A80195, + 67B2D0CA1018779D00A80195, + ); + isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 841779E7085A13B1000C01D8 = { + buildActionMask = 2147483647; + files = ( + 84C4E0400862096F000C01D8, + 84C4E0430862098A000C01D8, + 84C4E046086209D3000C01D8, + 84C4E049086209FF000C01D8, + 84C4E04E08620A46000C01D8, + 8494DFE80886EA0D000C01D8, + 849BD31D0A7E45B3000C01D8, + ); + isa = PBXFrameworksBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 841779E9085A13B1000C01D8 = { + buildPhases = ( + 840CE6B009198AA7000C01D8, + 6726EB5E10190F860074DCBA, + 6726EB5F10190FFC0074DCBA, + 841779E6085A13B1000C01D8, + 841779E7085A13B1000C01D8, + ); + buildSettings = { + FRAMEWORK_SEARCH_PATHS = "\"$(LOCAL_LIBRARY_DIR)/Frameworks\""; + HEADER_SEARCH_PATHS = "\"$(LOCAL_LIBRARY_DIR)/Frameworks/SDL.framework/Headers\" \"$(LOCAL_LIBRARY_DIR)/Frameworks/SDL_mixer.framework/Headers\" \"$(LOCAL_LIBRARY_DIR)/Frameworks/OpenAL.framework/Headers\" \"$(LOCAL_LIBRARY_DIR)/Frameworks/libpng.framework/Headers\""; + INSTALL_PATH = "$(HOME)/Applications"; + OPTIMIZATION_CFLAGS = "-O0"; + OTHER_CFLAGS = "-DMAC_ALERT -DUNIXCOMMON -DSDLMAIN -DHAVE_MIXER -DHAVE_PNG -D_BIG_ENDIAN -DSTDC_HEADERS -DSDL -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wsign-compare -Waggregate-return -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -fno-strict-aliasing -fno-exceptions -D_DEBUG"; + OTHER_REZFLAGS = ""; + PREBINDING = NO; + PRODUCT_NAME = Srb2Debug; + SECTORDER_FLAGS = ""; + USE_GCC3_PFE_SUPPORT = NO; + WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas -Wno-long-double"; + WRAPPER_EXTENSION = app; + }; + dependencies = ( + ); + isa = PBXApplicationTarget; + name = Srb2Debug; + productInstallPath = "$(HOME)/Applications"; + productName = Srb2Debug; + productReference = 841779EA085A13B1000C01D8; + productSettingsXML = " + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + Srb2Debug + CFBundleGetInfoString + + CFBundleIconFile + srb2mac + CFBundleIdentifier + + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Sonic Robo Blast 2 + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.09 + CFBundleSignature + ???? + CFBundleVersion + 1.09 Debug + NSMainNibFile + SDL_Main.nib + NSPrincipalClass + NSApplication + + +"; + }; + 841779EA085A13B1000C01D8 = { + isa = PBXApplicationReference; + path = Srb2Debug.app; + refType = 3; + }; + 84177A2A085A18A8000C01D8 = { + fileRef = 84177713085A0FCE000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A2E085A18D2000C01D8 = { + fileRef = 84177717085A0FCE000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A30085A18D3000C01D8 = { + fileRef = 84177719085A0FCE000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A32085A18D4000C01D8 = { + fileRef = 8417771B085A0FCE000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A34085A18D5000C01D8 = { + fileRef = 8417771D085A0FCE000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A39085A18D8000C01D8 = { + fileRef = 84177722085A0FCE000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A41085A18E0000C01D8 = { + fileRef = 8417772A085A100E000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A43085A18E1000C01D8 = { + fileRef = 8417772C085A100E000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A46085A18E8000C01D8 = { + fileRef = 841778C4085A1295000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A4A085A18EA000C01D8 = { + fileRef = 8417772D085A1029000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A4E085A18EC000C01D8 = { + fileRef = 841779D4085A1296000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A50085A18F2000C01D8 = { + fileRef = 8417772F085A1029000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A52085A193F000C01D8 = { + fileRef = 841778C2085A1295000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A53085A1940000C01D8 = { + fileRef = 841778C0085A1295000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A54085A1942000C01D8 = { + fileRef = 841778BE085A1295000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A55085A1943000C01D8 = { + fileRef = 84177732085A1040000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A56085A195A000C01D8 = { + fileRef = 841779D2085A1296000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A57085A195B000C01D8 = { + fileRef = 841779D8085A1296000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A58085A1968000C01D8 = { + fileRef = 84177734085A106C000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A59085A1969000C01D8 = { + fileRef = 84177735085A106C000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A5A085A196B000C01D8 = { + fileRef = 84177739085A106C000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A5B085A197A000C01D8 = { + fileRef = 8417773D085A106C000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A5C085A197C000C01D8 = { + fileRef = 8417773F085A106C000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A5D085A197D000C01D8 = { + fileRef = 84177741085A106C000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A5E085A197E000C01D8 = { + fileRef = 84177743085A106C000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A5F085A1980000C01D8 = { + fileRef = 84177745085A106C000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A61085A1985000C01D8 = { + fileRef = 84177749085A1097000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A62085A1986000C01D8 = { + fileRef = 8417774B085A1097000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A63085A1988000C01D8 = { + fileRef = 8417774E085A1097000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A64085A1989000C01D8 = { + fileRef = 8417774F085A1097000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A65085A198A000C01D8 = { + fileRef = 84177750085A1097000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A66085A198A000C01D8 = { + fileRef = 84177751085A1097000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A67085A198B000C01D8 = { + fileRef = 84177752085A1097000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A68085A198C000C01D8 = { + fileRef = 84177753085A1097000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A69085A198E000C01D8 = { + fileRef = 84177755085A10AA000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A6B085A1994000C01D8 = { + fileRef = 841777AA085A1200000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A6C085A1995000C01D8 = { + fileRef = 841777AD085A1200000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A6D085A199D000C01D8 = { + fileRef = 8417774C085A1097000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A6E085A19A0000C01D8 = { + fileRef = 8417775A085A10EB000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A6F085A19A1000C01D8 = { + fileRef = 8417775C085A10EB000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A70085A19A2000C01D8 = { + fileRef = 8417775E085A10EB000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A71085A19A4000C01D8 = { + fileRef = 84177760085A10EB000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A72085A19A5000C01D8 = { + fileRef = 84177762085A10EB000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A73085A19A6000C01D8 = { + fileRef = 84177764085A10EB000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A74085A19A7000C01D8 = { + fileRef = 84177766085A10EB000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A75085A19AC000C01D8 = { + fileRef = 84177769085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A76085A19AD000C01D8 = { + fileRef = 8417776A085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A77085A19AE000C01D8 = { + fileRef = 8417776B085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A78085A19AE000C01D8 = { + fileRef = 8417776C085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A79085A19AF000C01D8 = { + fileRef = 8417776D085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A7A085A19B0000C01D8 = { + fileRef = 8417776E085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A7B085A19B3000C01D8 = { + fileRef = 84177770085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A7C085A19B4000C01D8 = { + fileRef = 84177771085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A7D085A19B5000C01D8 = { + fileRef = 84177773085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A7E085A19B7000C01D8 = { + fileRef = 84177776085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A7F085A19B8000C01D8 = { + fileRef = 84177778085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A80085A19B9000C01D8 = { + fileRef = 8417777A085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A81085A19BA000C01D8 = { + fileRef = 8417777B085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A82085A19BB000C01D8 = { + fileRef = 8417777D085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A83085A19BB000C01D8 = { + fileRef = 8417777E085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A84085A19BC000C01D8 = { + fileRef = 84177780085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A85085A19C1000C01D8 = { + fileRef = 84177781085A111B000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A86085A19C2000C01D8 = { + fileRef = 84177783085A111B000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A87085A19C3000C01D8 = { + fileRef = 84177786085A111B000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A88085A19C6000C01D8 = { + fileRef = 8417778B085A111B000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A89085A19C7000C01D8 = { + fileRef = 8417778D085A111B000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A8A085A19C9000C01D8 = { + fileRef = 8417778F085A111B000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A8B085A19CC000C01D8 = { + fileRef = 84177791085A111B000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A8C085A19CD000C01D8 = { + fileRef = 84177793085A111B000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A8D085A19CF000C01D8 = { + fileRef = 84177796085A111B000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A8E085A19D0000C01D8 = { + fileRef = 841777A2085A1197000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A90085A19D8000C01D8 = { + fileRef = 84177798085A1138000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A91085A19D9000C01D8 = { + fileRef = 8417779A085A1138000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A92085A19DD000C01D8 = { + fileRef = 8417779C085A114C000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A93085A19DF000C01D8 = { + fileRef = 8417779F085A116B000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A94085A19E1000C01D8 = { + fileRef = 841777A0085A117F000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A95085A19E3000C01D8 = { + fileRef = 841777AF085A1228000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A96085A19E6000C01D8 = { + fileRef = 841778BC085A122A000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A98085A1A0B000C01D8 = { + fileRef = 84177713085A0FCE000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A99085A1A0E000C01D8 = { + fileRef = 84177717085A0FCE000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A9A085A1A0F000C01D8 = { + fileRef = 84177719085A0FCE000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A9B085A1A11000C01D8 = { + fileRef = 8417771B085A0FCE000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A9C085A1A12000C01D8 = { + fileRef = 8417771D085A0FCE000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A9D085A1A14000C01D8 = { + fileRef = 84177722085A0FCE000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177A9F085A1A1E000C01D8 = { + fileRef = 8417772A085A100E000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AA0085A1A1F000C01D8 = { + fileRef = 8417772C085A100E000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AA1085A1A24000C01D8 = { + fileRef = 841778C4085A1295000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AA2085A1A25000C01D8 = { + fileRef = 8417772D085A1029000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AA3085A1A27000C01D8 = { + fileRef = 8417772F085A1029000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AA4085A1A28000C01D8 = { + fileRef = 841779D4085A1296000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AA5085A1A2B000C01D8 = { + fileRef = 841778BE085A1295000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AA6085A1A2C000C01D8 = { + fileRef = 841778C2085A1295000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AA7085A1A2D000C01D8 = { + fileRef = 841778C0085A1295000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AA8085A1A2F000C01D8 = { + fileRef = 84177732085A1040000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AA9085A1A30000C01D8 = { + fileRef = 841779D2085A1296000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AAA085A1A31000C01D8 = { + fileRef = 841779D8085A1296000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AB4085A1A5E000C01D8 = { + fileRef = 84177749085A1097000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AB5085A1A60000C01D8 = { + fileRef = 8417774B085A1097000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AB8085A1A65000C01D8 = { + fileRef = 8417774E085A1097000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AB9085A1A65000C01D8 = { + fileRef = 8417774F085A1097000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177ABA085A1A66000C01D8 = { + fileRef = 84177750085A1097000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177ABB085A1A67000C01D8 = { + fileRef = 84177751085A1097000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177ABC085A1A67000C01D8 = { + fileRef = 84177752085A1097000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177ABD085A1A68000C01D8 = { + fileRef = 84177753085A1097000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AC1085A1A70000C01D8 = { + fileRef = 841777AA085A1200000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AC2085A1A72000C01D8 = { + fileRef = 841777AD085A1200000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AC3085A1A77000C01D8 = { + fileRef = 8417775A085A10EB000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AC4085A1A78000C01D8 = { + fileRef = 8417775C085A10EB000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AC5085A1A7A000C01D8 = { + fileRef = 8417775E085A10EB000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AC6085A1A7B000C01D8 = { + fileRef = 84177760085A10EB000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AC7085A1A7C000C01D8 = { + fileRef = 84177762085A10EB000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AC8085A1A7D000C01D8 = { + fileRef = 84177764085A10EB000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AC9085A1A7F000C01D8 = { + fileRef = 84177766085A10EB000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177ACA085A1A87000C01D8 = { + fileRef = 84177769085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177ACB085A1A88000C01D8 = { + fileRef = 8417776A085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177ACC085A1A88000C01D8 = { + fileRef = 8417776B085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177ACD085A1A89000C01D8 = { + fileRef = 8417776C085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177ACE085A1A8A000C01D8 = { + fileRef = 8417776D085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177ACF085A1A8B000C01D8 = { + fileRef = 8417776E085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AD0085A1A8C000C01D8 = { + fileRef = 84177770085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AD1085A1A8D000C01D8 = { + fileRef = 84177771085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AD2085A1A90000C01D8 = { + fileRef = 84177773085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AD4085A1A92000C01D8 = { + fileRef = 84177778085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AD5085A1A93000C01D8 = { + fileRef = 8417777A085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AD6085A1A94000C01D8 = { + fileRef = 8417777B085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AD7085A1A97000C01D8 = { + fileRef = 8417777D085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AD8085A1A97000C01D8 = { + fileRef = 8417777E085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AD9085A1A99000C01D8 = { + fileRef = 84177780085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177ADA085A1A9F000C01D8 = { + fileRef = 84177781085A111B000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177ADB085A1AA0000C01D8 = { + fileRef = 84177783085A111B000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177ADC085A1AA2000C01D8 = { + fileRef = 84177786085A111B000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177ADF085A1AA4000C01D8 = { + fileRef = 8417778B085A111B000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AE0085A1AA6000C01D8 = { + fileRef = 8417778D085A111B000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AE1085A1AA7000C01D8 = { + fileRef = 8417778F085A111B000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AE2085A1AA8000C01D8 = { + fileRef = 84177791085A111B000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AE3085A1AA9000C01D8 = { + fileRef = 84177793085A111B000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AE4085A1AAA000C01D8 = { + fileRef = 84177796085A111B000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AE5085A1AAE000C01D8 = { + fileRef = 841777A2085A1197000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AE7085A1AB5000C01D8 = { + fileRef = 84177798085A1138000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AE8085A1AB6000C01D8 = { + fileRef = 8417779A085A1138000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AEB085A1ABD000C01D8 = { + fileRef = 841777AF085A1228000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AEC085A1ABF000C01D8 = { + fileRef = 841777A0085A117F000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84177AED085A1ABF000C01D8 = { + fileRef = 841778BC085A122A000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 8490D432085DF3D6000C01D8 = { + fileRef = 84177776085A1104000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 8490D433085DF537000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = y_inter.h; + path = ../../y_inter.h; + refType = 2; + }; + 8490D436085DF57B000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = v_video.c; + path = ../../v_video.c; + refType = 2; + }; + 8490D437085DF57B000C01D8 = { + fileRef = 8490D436085DF57B000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 8490D438085DF57B000C01D8 = { + fileRef = 8490D436085DF57B000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 8490D43C085E0518000C01D8 = { + fileRef = 8417779F085A116B000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 8490D43D085E05F6000C01D8 = { + fileRef = 84177734085A106C000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 8490D43E085E05F7000C01D8 = { + fileRef = 84177735085A106C000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 8490D43F085E05F8000C01D8 = { + fileRef = 84177739085A106C000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 8490D440085E05FA000C01D8 = { + fileRef = 8417773D085A106C000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 8490D441085E05FB000C01D8 = { + fileRef = 8417773F085A106C000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 8490D442085E05FC000C01D8 = { + fileRef = 84177741085A106C000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 8490D443085E05FE000C01D8 = { + fileRef = 84177743085A106C000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 8490D444085E05FF000C01D8 = { + fileRef = 84177745085A106C000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 8490D445085E0606000C01D8 = { + fileRef = 8417774C085A1097000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 8490D446085E060A000C01D8 = { + fileRef = 84177755085A10AA000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 8490D447085E060B000C01D8 = { + fileRef = 84177758085A10D2000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 8490D448085E067E000C01D8 = { + fileRef = 8417779C085A114C000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 8494DFE80886EA0D000C01D8 = { + fileRef = 84C4E04B08620A46000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 849603A80A791C11000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = comptime.c; + path = ../../comptime.c; + refType = 2; + }; + 849603A90A791C11000C01D8 = { + fileRef = 849603A80A791C11000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 849603AA0A791C11000C01D8 = { + fileRef = 849603A80A791C11000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 849BD31C0A7E45B3000C01D8 = { + isa = PBXFrameworkReference; + name = libpng.framework; + path = /Library/Frameworks/libpng.framework; + refType = 0; + }; + 849BD31D0A7E45B3000C01D8 = { + fileRef = 849BD31C0A7E45B3000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 849BD31E0A7E45B3000C01D8 = { + fileRef = 849BD31C0A7E45B3000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 849BD32D0A7E471D000C01D8 = { + fileRef = 849BD31C0A7E45B3000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84C4E00D0862063C000C01D8 = { + children = ( + 6755C8BE101802C300A80195, + 6755C8BF101802C300A80195, + 6755C8C0101802C300A80195, + 6755C8C1101802C300A80195, + 6755C8C2101802C300A80195, + 6755C8C3101802C300A80195, + 6755C8C4101802C300A80195, + 6755C8C5101802C300A80195, + 6755C8C6101802C300A80195, + ); + isa = PBXGroup; + name = Data; + refType = 4; + }; + 84C4E03F0862096F000C01D8 = { + isa = PBXFrameworkReference; + name = AppKit.framework; + path = /System/Library/Frameworks/AppKit.framework; + refType = 0; + }; + 84C4E0400862096F000C01D8 = { + fileRef = 84C4E03F0862096F000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84C4E0410862096F000C01D8 = { + fileRef = 84C4E03F0862096F000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84C4E0420862098A000C01D8 = { + isa = PBXFrameworkReference; + name = Foundation.framework; + path = /System/Library/Frameworks/Foundation.framework; + refType = 0; + }; + 84C4E0430862098A000C01D8 = { + fileRef = 84C4E0420862098A000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84C4E0440862098A000C01D8 = { + fileRef = 84C4E0420862098A000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84C4E045086209D3000C01D8 = { + isa = PBXFrameworkReference; + name = CoreFoundation.framework; + path = /System/Library/Frameworks/CoreFoundation.framework; + refType = 0; + }; + 84C4E046086209D3000C01D8 = { + fileRef = 84C4E045086209D3000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84C4E047086209D3000C01D8 = { + fileRef = 84C4E045086209D3000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84C4E048086209FF000C01D8 = { + isa = PBXFrameworkReference; + name = ApplicationServices.framework; + path = /System/Library/Frameworks/ApplicationServices.framework; + refType = 0; + }; + 84C4E049086209FF000C01D8 = { + fileRef = 84C4E048086209FF000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84C4E04A086209FF000C01D8 = { + fileRef = 84C4E048086209FF000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84C4E04B08620A46000C01D8 = { + isa = PBXFrameworkReference; + name = SDL_mixer.framework; + path = /Library/Frameworks/SDL_mixer.framework; + refType = 0; + }; + 84C4E04C08620A46000C01D8 = { + isa = PBXFrameworkReference; + name = SDL.framework; + path = /Library/Frameworks/SDL.framework; + refType = 0; + }; + 84C4E04E08620A46000C01D8 = { + fileRef = 84C4E04C08620A46000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84C4E04F08620A46000C01D8 = { + fileRef = 84C4E04B08620A46000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84C4E05008620A46000C01D8 = { + fileRef = 84C4E04C08620A46000C01D8; + isa = PBXBuildFile; + settings = { + }; + }; + 84F202C708A92A5D000C01D8 = { + isa = PBXFrameworkReference; + name = OpenAL.framework; + path = /Library/Frameworks/OpenAL.framework; + refType = 0; + }; + 84F202CA08A92AA0000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = s_openal.c; + path = ../../hardware/s_openal/s_openal.c; + refType = 2; + }; + }; + rootObject = 84177702085A0C64000C01D8; +} diff --git a/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj new file mode 100644 index 000000000..b2d687e24 --- /dev/null +++ b/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj @@ -0,0 +1,1510 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 44; + objects = { + +/* Begin PBXBuildFile section */ + 002F39FA09D0881F00EBEB88 /* SDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F39F909D0881F00EBEB88 /* SDL.framework */; }; + 002F3A0009D0884600EBEB88 /* SDL.framework in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = 002F39F909D0881F00EBEB88 /* SDL.framework */; }; + 1E308E720B71172D0015728C /* lzf.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44B2240B67EADE00BAD059 /* lzf.c */; }; + 1E32C4290B6E6D5D0029E058 /* libpng.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1E32C4140B6E6D5D0029E058 /* libpng.framework */; }; + 1E32C42B0B6E6D6E0029E058 /* libpng.framework in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = 1E32C4140B6E6D5D0029E058 /* libpng.framework */; }; + 1E44AE750B67CC2B00BAD059 /* hw_bsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE610B67CC2B00BAD059 /* hw_bsp.c */; }; + 1E44AE770B67CC2B00BAD059 /* hw3sound.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE630B67CC2B00BAD059 /* hw3sound.c */; }; + 1E44AE780B67CC2B00BAD059 /* hw_cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE640B67CC2B00BAD059 /* hw_cache.c */; }; + 1E44AE7C0B67CC2B00BAD059 /* hw_light.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE680B67CC2B00BAD059 /* hw_light.c */; }; + 1E44AE800B67CC2B00BAD059 /* hw_draw.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE6C0B67CC2B00BAD059 /* hw_draw.c */; }; + 1E44AE820B67CC2B00BAD059 /* hw_main.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE6E0B67CC2B00BAD059 /* hw_main.c */; }; + 1E44AE840B67CC2B00BAD059 /* hw_md2.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE700B67CC2B00BAD059 /* hw_md2.c */; }; + 1E44AE860B67CC2B00BAD059 /* hw_trick.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE720B67CC2B00BAD059 /* hw_trick.c */; }; + 1E44AEA40B67CC8500BAD059 /* d_clisrv.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE8D0B67CC8400BAD059 /* d_clisrv.c */; }; + 1E44AEA70B67CC8500BAD059 /* d_main.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE900B67CC8400BAD059 /* d_main.c */; }; + 1E44AEA80B67CC8500BAD059 /* d_net.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE910B67CC8500BAD059 /* d_net.c */; }; + 1E44AEAB0B67CC8500BAD059 /* d_netfil.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE940B67CC8500BAD059 /* d_netfil.c */; }; + 1E44AEAF0B67CC8500BAD059 /* d_netcmd.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE980B67CC8500BAD059 /* d_netcmd.c */; }; + 1E44AEB30B67CC8500BAD059 /* dehacked.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE9C0B67CC8500BAD059 /* dehacked.c */; }; + 1E44AEBF0B67CCA900BAD059 /* f_wipe.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEBC0B67CCA900BAD059 /* f_wipe.c */; }; + 1E44AEC00B67CCA900BAD059 /* f_finale.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEBD0B67CCA900BAD059 /* f_finale.c */; }; + 1E44AEC80B67CCC600BAD059 /* g_game.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEC30B67CCC600BAD059 /* g_game.c */; }; + 1E44AECC0B67CCC600BAD059 /* g_input.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEC70B67CCC600BAD059 /* g_input.c */; }; + 1E44AED00B67CCEE00BAD059 /* hu_stuff.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AECE0B67CCEE00BAD059 /* hu_stuff.c */; }; + 1E44AEDC0B67CD1300BAD059 /* i_tcp.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AED50B67CD1200BAD059 /* i_tcp.c */; }; + 1E44AEE30B67CD2B00BAD059 /* am_map.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEE10B67CD2B00BAD059 /* am_map.c */; }; + 1E44AEE90B67CD3F00BAD059 /* command.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEE70B67CD3F00BAD059 /* command.c */; }; + 1E44AEEC0B67CD4400BAD059 /* comptime.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEEB0B67CD4400BAD059 /* comptime.c */; }; + 1E44AEEF0B67CD5400BAD059 /* console.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEED0B67CD5400BAD059 /* console.c */; }; + 1E44AEF30B67CD7F00BAD059 /* filesrch.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEF10B67CD7F00BAD059 /* filesrch.c */; }; + 1E44AF070B67CDE900BAD059 /* m_argv.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEF80B67CDE900BAD059 /* m_argv.c */; }; + 1E44AF0A0B67CDE900BAD059 /* m_cheat.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEFB0B67CDE900BAD059 /* m_cheat.c */; }; + 1E44AF0B0B67CDE900BAD059 /* m_bbox.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEFC0B67CDE900BAD059 /* m_bbox.c */; }; + 1E44AF0D0B67CDE900BAD059 /* m_fixed.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEFE0B67CDE900BAD059 /* m_fixed.c */; }; + 1E44AF0F0B67CDE900BAD059 /* m_menu.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF000B67CDE900BAD059 /* m_menu.c */; }; + 1E44AF110B67CDE900BAD059 /* m_misc.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF020B67CDE900BAD059 /* m_misc.c */; }; + 1E44AF130B67CDE900BAD059 /* m_random.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF040B67CDE900BAD059 /* m_random.c */; }; + 1E44AF1A0B67CE2A00BAD059 /* info.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF180B67CE2A00BAD059 /* info.c */; }; + 1E44AF1E0B67CE3600BAD059 /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF1C0B67CE3600BAD059 /* md5.c */; }; + 1E44AF220B67CE4100BAD059 /* mserv.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF200B67CE4100BAD059 /* mserv.c */; }; + 1E44AF3C0B67CE5F00BAD059 /* p_enemy.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF240B67CE5F00BAD059 /* p_enemy.c */; }; + 1E44AF3D0B67CE5F00BAD059 /* p_inter.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF250B67CE5F00BAD059 /* p_inter.c */; }; + 1E44AF3E0B67CE5F00BAD059 /* p_fab.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF260B67CE5F00BAD059 /* p_fab.c */; }; + 1E44AF3F0B67CE5F00BAD059 /* p_lights.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF270B67CE5F00BAD059 /* p_lights.c */; }; + 1E44AF400B67CE5F00BAD059 /* p_map.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF280B67CE5F00BAD059 /* p_map.c */; }; + 1E44AF410B67CE5F00BAD059 /* p_maputl.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF290B67CE5F00BAD059 /* p_maputl.c */; }; + 1E44AF430B67CE5F00BAD059 /* p_mobj.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF2B0B67CE5F00BAD059 /* p_mobj.c */; }; + 1E44AF450B67CE5F00BAD059 /* p_floor.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF2D0B67CE5F00BAD059 /* p_floor.c */; }; + 1E44AF480B67CE5F00BAD059 /* p_saveg.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF300B67CE5F00BAD059 /* p_saveg.c */; }; + 1E44AF4A0B67CE5F00BAD059 /* p_setup.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF320B67CE5F00BAD059 /* p_setup.c */; }; + 1E44AF4C0B67CE5F00BAD059 /* p_sight.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF340B67CE5F00BAD059 /* p_sight.c */; }; + 1E44AF4D0B67CE5F00BAD059 /* p_spec.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF350B67CE5F00BAD059 /* p_spec.c */; }; + 1E44AF4F0B67CE5F00BAD059 /* p_telept.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF370B67CE5F00BAD059 /* p_telept.c */; }; + 1E44AF500B67CE5F00BAD059 /* p_tick.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF380B67CE5F00BAD059 /* p_tick.c */; }; + 1E44AF520B67CE5F00BAD059 /* p_user.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF3A0B67CE5F00BAD059 /* p_user.c */; }; + 1E44AF530B67CE5F00BAD059 /* p_ceilng.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF3B0B67CE5F00BAD059 /* p_ceilng.c */; }; + 1E44AF6C0B67CEC200BAD059 /* r_bsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF550B67CEC100BAD059 /* r_bsp.c */; }; + 1E44AF6F0B67CEC200BAD059 /* r_data.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF580B67CEC100BAD059 /* r_data.c */; }; + 1E44AF700B67CEC200BAD059 /* r_draw.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF590B67CEC100BAD059 /* r_draw.c */; }; + 1E44AF730B67CEC200BAD059 /* r_main.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF5C0B67CEC100BAD059 /* r_main.c */; }; + 1E44AF780B67CEC200BAD059 /* r_plane.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF610B67CEC100BAD059 /* r_plane.c */; }; + 1E44AF7A0B67CEC200BAD059 /* r_segs.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF630B67CEC100BAD059 /* r_segs.c */; }; + 1E44AF7C0B67CEC200BAD059 /* r_sky.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF650B67CEC200BAD059 /* r_sky.c */; }; + 1E44AF7E0B67CEC200BAD059 /* r_splats.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF670B67CEC200BAD059 /* r_splats.c */; }; + 1E44AF810B67CEC200BAD059 /* r_things.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF6A0B67CEC200BAD059 /* r_things.c */; }; + 1E44AF870B67CEE000BAD059 /* s_sound.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF850B67CEE000BAD059 /* s_sound.c */; }; + 1E44AF8B0B67CEE900BAD059 /* screen.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF890B67CEE900BAD059 /* screen.c */; }; + 1E44AF8F0B67CEF000BAD059 /* sounds.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF8D0B67CEF000BAD059 /* sounds.c */; }; + 1E44AF930B67CEFF00BAD059 /* st_stuff.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF910B67CEFF00BAD059 /* st_stuff.c */; }; + 1E44AF9B0B67CF2E00BAD059 /* tables.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF990B67CF2E00BAD059 /* tables.c */; }; + 1E44AFA50B67CF5D00BAD059 /* v_video.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFA30B67CF5D00BAD059 /* v_video.c */; }; + 1E44AFA90B67CF6400BAD059 /* w_wad.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFA70B67CF6400BAD059 /* w_wad.c */; }; + 1E44AFAD0B67CF6F00BAD059 /* y_inter.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFAB0B67CF6F00BAD059 /* y_inter.c */; }; + 1E44AFB10B67CF7A00BAD059 /* z_zone.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFAF0B67CF7A00BAD059 /* z_zone.c */; }; + 1E44AFC40B67CFDC00BAD059 /* dosstr.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFB40B67CFDC00BAD059 /* dosstr.c */; }; + 1E44AFC50B67CFDC00BAD059 /* endtxt.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFB50B67CFDC00BAD059 /* endtxt.c */; }; + 1E44AFC70B67CFDC00BAD059 /* hwsym_sdl.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFB70B67CFDC00BAD059 /* hwsym_sdl.c */; }; + 1E44AFC90B67CFDC00BAD059 /* i_cdmus.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFB90B67CFDC00BAD059 /* i_cdmus.c */; }; + 1E44AFCA0B67CFDC00BAD059 /* i_main.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFBA0B67CFDC00BAD059 /* i_main.c */; }; + 1E44AFCB0B67CFDC00BAD059 /* i_net.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFBB0B67CFDC00BAD059 /* i_net.c */; }; + 1E44AFCD0B67CFDC00BAD059 /* i_system.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFBD0B67CFDC00BAD059 /* i_system.c */; }; + 1E44AFCE0B67CFDC00BAD059 /* i_video.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFBE0B67CFDC00BAD059 /* i_video.c */; }; + 1E44AFD00B67CFDC00BAD059 /* ogl_sdl.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFC00B67CFDC00BAD059 /* ogl_sdl.c */; }; + 1E44AFEA0B67D06200BAD059 /* Srb2mac.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1E44AFE70B67D06200BAD059 /* Srb2mac.icns */; }; + 1E44AFEB0B67D06200BAD059 /* mac_alert.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFE80B67D06200BAD059 /* mac_alert.c */; }; + 1E44AFED0B67D0AB00BAD059 /* r_opengl.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFEC0B67D0AB00BAD059 /* r_opengl.c */; }; + 1E44B0590B67D81E00BAD059 /* SDL_macosx_main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E44B0570B67D81E00BAD059 /* SDL_macosx_main.m */; }; + 1E66921C0B690C5B00B7313A /* SDL_mixer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1E66921B0B690C5B00B7313A /* SDL_mixer.framework */; }; + 1E66921D0B690C6B00B7313A /* SDL_mixer.framework in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = 1E66921B0B690C5B00B7313A /* SDL_mixer.framework */; }; + 67259DFD18D2687D00F02971 /* lua_hudlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67259DFB18D2687D00F02971 /* lua_hudlib.c */; }; + 67259DFE18D2687D00F02971 /* lua_skinlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67259DFC18D2687D00F02971 /* lua_skinlib.c */; }; + 67259E0118D268AE00F02971 /* m_anigif.c in Sources */ = {isa = PBXBuildFile; fileRef = 67259DFF18D268AE00F02971 /* m_anigif.c */; }; + 67259E0618D268F700F02971 /* i_ttf.c in Sources */ = {isa = PBXBuildFile; fileRef = 67259E0218D268F600F02971 /* i_ttf.c */; }; + 67259E0718D268F700F02971 /* mixer_sound.c in Sources */ = {isa = PBXBuildFile; fileRef = 67259E0418D268F600F02971 /* mixer_sound.c */; }; + 67259E0818D268F700F02971 /* sdl_sound.c in Sources */ = {isa = PBXBuildFile; fileRef = 67259E0518D268F600F02971 /* sdl_sound.c */; }; + 67259E2E18D26D5700F02971 /* patch.dta in Resources */ = {isa = PBXBuildFile; fileRef = 67259E2B18D26D5700F02971 /* patch.dta */; }; + 67259E2F18D26D5700F02971 /* rings.dta in Resources */ = {isa = PBXBuildFile; fileRef = 67259E2C18D26D5700F02971 /* rings.dta */; }; + 67259E3018D26D5700F02971 /* srb2.srb in Resources */ = {isa = PBXBuildFile; fileRef = 67259E2D18D26D5700F02971 /* srb2.srb */; }; + 67259E3218D26DD200F02971 /* music.dta in Resources */ = {isa = PBXBuildFile; fileRef = 1E44AE440B67CBE800BAD059 /* music.dta */; }; + 67259E3318D26DD300F02971 /* player.dta in Resources */ = {isa = PBXBuildFile; fileRef = 67A1F91813FAD026009FA3E5 /* player.dta */; }; + 67259E3518D26DD500F02971 /* zones.dta in Resources */ = {isa = PBXBuildFile; fileRef = 6766C0AE11B057E50065F389 /* zones.dta */; }; + 676BB5200E0DE06100C95963 /* m_queue.c in Sources */ = {isa = PBXBuildFile; fileRef = 676BB51C0E0DE06100C95963 /* m_queue.c */; }; + 676BB5220E0DE06100C95963 /* p_polyobj.c in Sources */ = {isa = PBXBuildFile; fileRef = 676BB51E0E0DE06100C95963 /* p_polyobj.c */; }; + 67B83BFA14F57EAB00AAAE4E /* lapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BCB14F57EAB00AAAE4E /* lapi.c */; }; + 67B83BFB14F57EAB00AAAE4E /* lauxlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BCD14F57EAB00AAAE4E /* lauxlib.c */; }; + 67B83BFC14F57EAB00AAAE4E /* lbaselib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BCF14F57EAB00AAAE4E /* lbaselib.c */; }; + 67B83BFD14F57EAB00AAAE4E /* lcode.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BD014F57EAB00AAAE4E /* lcode.c */; }; + 67B83BFE14F57EAB00AAAE4E /* ldebug.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BD214F57EAB00AAAE4E /* ldebug.c */; }; + 67B83BFF14F57EAB00AAAE4E /* ldo.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BD414F57EAB00AAAE4E /* ldo.c */; }; + 67B83C0014F57EAB00AAAE4E /* ldump.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BD614F57EAB00AAAE4E /* ldump.c */; }; + 67B83C0114F57EAB00AAAE4E /* lfunc.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BD714F57EAB00AAAE4E /* lfunc.c */; }; + 67B83C0214F57EAB00AAAE4E /* lgc.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BD914F57EAB00AAAE4E /* lgc.c */; }; + 67B83C0314F57EAB00AAAE4E /* linit.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BDB14F57EAB00AAAE4E /* linit.c */; }; + 67B83C0414F57EAB00AAAE4E /* llex.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BDC14F57EAB00AAAE4E /* llex.c */; }; + 67B83C0514F57EAB00AAAE4E /* lmem.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BDF14F57EAB00AAAE4E /* lmem.c */; }; + 67B83C0614F57EAB00AAAE4E /* lobject.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BE114F57EAB00AAAE4E /* lobject.c */; }; + 67B83C0714F57EAB00AAAE4E /* lopcodes.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BE314F57EAB00AAAE4E /* lopcodes.c */; }; + 67B83C0814F57EAB00AAAE4E /* lparser.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BE514F57EAB00AAAE4E /* lparser.c */; }; + 67B83C0914F57EAB00AAAE4E /* lstate.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BE714F57EAB00AAAE4E /* lstate.c */; }; + 67B83C0A14F57EAB00AAAE4E /* lstring.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BE914F57EAB00AAAE4E /* lstring.c */; }; + 67B83C0B14F57EAB00AAAE4E /* lstrlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BEB14F57EAB00AAAE4E /* lstrlib.c */; }; + 67B83C0C14F57EAB00AAAE4E /* ltable.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BEC14F57EAB00AAAE4E /* ltable.c */; }; + 67B83C0D14F57EAB00AAAE4E /* ltablib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BEE14F57EAB00AAAE4E /* ltablib.c */; }; + 67B83C0E14F57EAB00AAAE4E /* ltm.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BEF14F57EAB00AAAE4E /* ltm.c */; }; + 67B83C0F14F57EAB00AAAE4E /* lundump.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BF414F57EAB00AAAE4E /* lundump.c */; }; + 67B83C1014F57EAB00AAAE4E /* lvm.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BF614F57EAB00AAAE4E /* lvm.c */; }; + 67B83C1114F57EAB00AAAE4E /* lzio.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BF814F57EAB00AAAE4E /* lzio.c */; }; + 67B83C1414F57ECA00AAAE4E /* b_bot.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C1214F57ECA00AAAE4E /* b_bot.c */; }; + 67B83C2214F57EE600AAAE4E /* lua_baselib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C1514F57EE600AAAE4E /* lua_baselib.c */; }; + 67B83C2314F57EE600AAAE4E /* lua_consolelib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C1614F57EE600AAAE4E /* lua_consolelib.c */; }; + 67B83C2414F57EE600AAAE4E /* lua_hooklib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C1814F57EE600AAAE4E /* lua_hooklib.c */; }; + 67B83C2514F57EE600AAAE4E /* lua_infolib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C1914F57EE600AAAE4E /* lua_infolib.c */; }; + 67B83C2614F57EE600AAAE4E /* lua_maplib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C1B14F57EE600AAAE4E /* lua_maplib.c */; }; + 67B83C2714F57EE600AAAE4E /* lua_mathlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C1C14F57EE600AAAE4E /* lua_mathlib.c */; }; + 67B83C2814F57EE600AAAE4E /* lua_mobjlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C1D14F57EE600AAAE4E /* lua_mobjlib.c */; }; + 67B83C2914F57EE600AAAE4E /* lua_playerlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C1E14F57EE600AAAE4E /* lua_playerlib.c */; }; + 67B83C2A14F57EE600AAAE4E /* lua_script.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C1F14F57EE600AAAE4E /* lua_script.c */; }; + 67B83C2B14F57EE600AAAE4E /* lua_thinkerlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C2114F57EE600AAAE4E /* lua_thinkerlib.c */; }; + 67B83C3314F57F1500AAAE4E /* m_cond.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C2F14F57F1500AAAE4E /* m_cond.c */; }; + 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 002F39FD09D0883400EBEB88 /* Copy Frameworks into .app bundle */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 12; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 1E32C42B0B6E6D6E0029E058 /* libpng.framework in Copy Frameworks into .app bundle */, + 1E66921D0B690C6B00B7313A /* SDL_mixer.framework in Copy Frameworks into .app bundle */, + 002F3A0009D0884600EBEB88 /* SDL.framework in Copy Frameworks into .app bundle */, + ); + name = "Copy Frameworks into .app bundle"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 002F39F909D0881F00EBEB88 /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL.framework; path = /Library/Frameworks/SDL.framework; sourceTree = ""; }; + 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; + 1E32C4140B6E6D5D0029E058 /* libpng.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = libpng.framework; path = /Library/Frameworks/libpng.framework; sourceTree = ""; }; + 1E44AE440B67CBE800BAD059 /* music.dta */ = {isa = PBXFileReference; lastKnownFileType = text; name = music.dta; path = ../../../bin/Resources/music.dta; sourceTree = SOURCE_ROOT; }; + 1E44AE4B0B67CBE800BAD059 /* srb2.wad */ = {isa = PBXFileReference; lastKnownFileType = text; name = srb2.wad; path = ../../../bin/Resources/srb2.wad; sourceTree = SOURCE_ROOT; }; + 1E44AE600B67CC2B00BAD059 /* hw3dsdrv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw3dsdrv.h; path = ../../hardware/hw3dsdrv.h; sourceTree = SOURCE_ROOT; }; + 1E44AE610B67CC2B00BAD059 /* hw_bsp.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_bsp.c; path = ../../hardware/hw_bsp.c; sourceTree = SOURCE_ROOT; }; + 1E44AE620B67CC2B00BAD059 /* hw_defs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_defs.h; path = ../../hardware/hw_defs.h; sourceTree = SOURCE_ROOT; }; + 1E44AE630B67CC2B00BAD059 /* hw3sound.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw3sound.c; path = ../../hardware/hw3sound.c; sourceTree = SOURCE_ROOT; }; + 1E44AE640B67CC2B00BAD059 /* hw_cache.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_cache.c; path = ../../hardware/hw_cache.c; sourceTree = SOURCE_ROOT; }; + 1E44AE650B67CC2B00BAD059 /* hw_dll.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_dll.h; path = ../../hardware/hw_dll.h; sourceTree = SOURCE_ROOT; }; + 1E44AE660B67CC2B00BAD059 /* hw_drv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_drv.h; path = ../../hardware/hw_drv.h; sourceTree = SOURCE_ROOT; }; + 1E44AE670B67CC2B00BAD059 /* hw_glide.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_glide.h; path = ../../hardware/hw_glide.h; sourceTree = SOURCE_ROOT; }; + 1E44AE680B67CC2B00BAD059 /* hw_light.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_light.c; path = ../../hardware/hw_light.c; sourceTree = SOURCE_ROOT; }; + 1E44AE690B67CC2B00BAD059 /* hw_light.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_light.h; path = ../../hardware/hw_light.h; sourceTree = SOURCE_ROOT; }; + 1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw3sound.h; path = ../../hardware/hw3sound.h; sourceTree = SOURCE_ROOT; }; + 1E44AE6B0B67CC2B00BAD059 /* hw_data.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_data.h; path = ../../hardware/hw_data.h; sourceTree = SOURCE_ROOT; }; + 1E44AE6C0B67CC2B00BAD059 /* hw_draw.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_draw.c; path = ../../hardware/hw_draw.c; sourceTree = SOURCE_ROOT; }; + 1E44AE6D0B67CC2B00BAD059 /* hw_glob.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_glob.h; path = ../../hardware/hw_glob.h; sourceTree = SOURCE_ROOT; }; + 1E44AE6E0B67CC2B00BAD059 /* hw_main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_main.c; path = ../../hardware/hw_main.c; sourceTree = SOURCE_ROOT; }; + 1E44AE6F0B67CC2B00BAD059 /* hw_main.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_main.h; path = ../../hardware/hw_main.h; sourceTree = SOURCE_ROOT; }; + 1E44AE700B67CC2B00BAD059 /* hw_md2.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_md2.c; path = ../../hardware/hw_md2.c; sourceTree = SOURCE_ROOT; }; + 1E44AE710B67CC2B00BAD059 /* hw_md2.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_md2.h; path = ../../hardware/hw_md2.h; sourceTree = SOURCE_ROOT; }; + 1E44AE720B67CC2B00BAD059 /* hw_trick.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_trick.c; path = ../../hardware/hw_trick.c; sourceTree = SOURCE_ROOT; }; + 1E44AE730B67CC2B00BAD059 /* hws_data.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hws_data.h; path = ../../hardware/hws_data.h; sourceTree = SOURCE_ROOT; }; + 1E44AE8A0B67CC6000BAD059 /* asm_defs.inc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.pascal; name = asm_defs.inc; path = ../../asm_defs.inc; sourceTree = SOURCE_ROOT; }; + 1E44AE8D0B67CC8400BAD059 /* d_clisrv.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = d_clisrv.c; path = ../../d_clisrv.c; sourceTree = SOURCE_ROOT; }; + 1E44AE8E0B67CC8400BAD059 /* d_clisrv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = d_clisrv.h; path = ../../d_clisrv.h; sourceTree = SOURCE_ROOT; }; + 1E44AE8F0B67CC8400BAD059 /* d_event.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = d_event.h; path = ../../d_event.h; sourceTree = SOURCE_ROOT; }; + 1E44AE900B67CC8400BAD059 /* d_main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = d_main.c; path = ../../d_main.c; sourceTree = SOURCE_ROOT; }; + 1E44AE910B67CC8500BAD059 /* d_net.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = d_net.c; path = ../../d_net.c; sourceTree = SOURCE_ROOT; }; + 1E44AE920B67CC8500BAD059 /* d_net.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = d_net.h; path = ../../d_net.h; sourceTree = SOURCE_ROOT; }; + 1E44AE930B67CC8500BAD059 /* d_netcmd.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = d_netcmd.h; path = ../../d_netcmd.h; sourceTree = SOURCE_ROOT; }; + 1E44AE940B67CC8500BAD059 /* d_netfil.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = d_netfil.c; path = ../../d_netfil.c; sourceTree = SOURCE_ROOT; }; + 1E44AE950B67CC8500BAD059 /* d_player.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = d_player.h; path = ../../d_player.h; sourceTree = SOURCE_ROOT; }; + 1E44AE960B67CC8500BAD059 /* d_think.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = d_think.h; path = ../../d_think.h; sourceTree = SOURCE_ROOT; }; + 1E44AE980B67CC8500BAD059 /* d_netcmd.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = d_netcmd.c; path = ../../d_netcmd.c; sourceTree = SOURCE_ROOT; }; + 1E44AE990B67CC8500BAD059 /* d_ticcmd.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = d_ticcmd.h; path = ../../d_ticcmd.h; sourceTree = SOURCE_ROOT; }; + 1E44AE9A0B67CC8500BAD059 /* d_main.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = d_main.h; path = ../../d_main.h; sourceTree = SOURCE_ROOT; }; + 1E44AE9B0B67CC8500BAD059 /* d_netfil.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = d_netfil.h; path = ../../d_netfil.h; sourceTree = SOURCE_ROOT; }; + 1E44AE9C0B67CC8500BAD059 /* dehacked.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dehacked.c; path = ../../dehacked.c; sourceTree = SOURCE_ROOT; }; + 1E44AE9D0B67CC8500BAD059 /* dehacked.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dehacked.h; path = ../../dehacked.h; sourceTree = SOURCE_ROOT; }; + 1E44AE9E0B67CC8500BAD059 /* doomdata.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = doomdata.h; path = ../../doomdata.h; sourceTree = SOURCE_ROOT; }; + 1E44AE9F0B67CC8500BAD059 /* doomdef.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = doomdef.h; path = ../../doomdef.h; sourceTree = SOURCE_ROOT; }; + 1E44AEA00B67CC8500BAD059 /* doomstat.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = doomstat.h; path = ../../doomstat.h; sourceTree = SOURCE_ROOT; }; + 1E44AEA10B67CC8500BAD059 /* doomtype.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = doomtype.h; path = ../../doomtype.h; sourceTree = SOURCE_ROOT; }; + 1E44AEBC0B67CCA900BAD059 /* f_wipe.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = f_wipe.c; path = ../../f_wipe.c; sourceTree = SOURCE_ROOT; }; + 1E44AEBD0B67CCA900BAD059 /* f_finale.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = f_finale.c; path = ../../f_finale.c; sourceTree = SOURCE_ROOT; }; + 1E44AEBE0B67CCA900BAD059 /* f_finale.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = f_finale.h; path = ../../f_finale.h; sourceTree = SOURCE_ROOT; }; + 1E44AEC30B67CCC600BAD059 /* g_game.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = g_game.c; path = ../../g_game.c; sourceTree = SOURCE_ROOT; }; + 1E44AEC40B67CCC600BAD059 /* g_game.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = g_game.h; path = ../../g_game.h; sourceTree = SOURCE_ROOT; }; + 1E44AEC50B67CCC600BAD059 /* g_input.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = g_input.h; path = ../../g_input.h; sourceTree = SOURCE_ROOT; }; + 1E44AEC60B67CCC600BAD059 /* g_state.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = g_state.h; path = ../../g_state.h; sourceTree = SOURCE_ROOT; }; + 1E44AEC70B67CCC600BAD059 /* g_input.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = g_input.c; path = ../../g_input.c; sourceTree = SOURCE_ROOT; }; + 1E44AECE0B67CCEE00BAD059 /* hu_stuff.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hu_stuff.c; path = ../../hu_stuff.c; sourceTree = SOURCE_ROOT; }; + 1E44AECF0B67CCEE00BAD059 /* hu_stuff.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hu_stuff.h; path = ../../hu_stuff.h; sourceTree = SOURCE_ROOT; }; + 1E44AED30B67CD1200BAD059 /* i_net.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = i_net.h; path = ../../i_net.h; sourceTree = SOURCE_ROOT; }; + 1E44AED40B67CD1200BAD059 /* i_sound.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = i_sound.h; path = ../../i_sound.h; sourceTree = SOURCE_ROOT; }; + 1E44AED50B67CD1200BAD059 /* i_tcp.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = i_tcp.c; path = ../../i_tcp.c; sourceTree = SOURCE_ROOT; }; + 1E44AED60B67CD1200BAD059 /* i_tcp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = i_tcp.h; path = ../../i_tcp.h; sourceTree = SOURCE_ROOT; }; + 1E44AED70B67CD1200BAD059 /* i_system.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = i_system.h; path = ../../i_system.h; sourceTree = SOURCE_ROOT; }; + 1E44AED80B67CD1200BAD059 /* i_video.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = i_video.h; path = ../../i_video.h; sourceTree = SOURCE_ROOT; }; + 1E44AED90B67CD1300BAD059 /* i_joy.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = i_joy.h; path = ../../i_joy.h; sourceTree = SOURCE_ROOT; }; + 1E44AEE10B67CD2B00BAD059 /* am_map.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = am_map.c; path = ../../am_map.c; sourceTree = SOURCE_ROOT; }; + 1E44AEE20B67CD2B00BAD059 /* am_map.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = am_map.h; path = ../../am_map.h; sourceTree = SOURCE_ROOT; }; + 1E44AEE50B67CD3200BAD059 /* byteptr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = byteptr.h; path = ../../byteptr.h; sourceTree = SOURCE_ROOT; }; + 1E44AEE70B67CD3F00BAD059 /* command.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = command.c; path = ../../command.c; sourceTree = SOURCE_ROOT; }; + 1E44AEE80B67CD3F00BAD059 /* command.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = command.h; path = ../../command.h; sourceTree = SOURCE_ROOT; }; + 1E44AEEB0B67CD4400BAD059 /* comptime.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = comptime.c; path = ../../comptime.c; sourceTree = SOURCE_ROOT; }; + 1E44AEED0B67CD5400BAD059 /* console.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = console.c; path = ../../console.c; sourceTree = SOURCE_ROOT; }; + 1E44AEEE0B67CD5400BAD059 /* console.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = console.h; path = ../../console.h; sourceTree = SOURCE_ROOT; }; + 1E44AEF10B67CD7F00BAD059 /* filesrch.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = filesrch.c; path = ../../filesrch.c; sourceTree = SOURCE_ROOT; }; + 1E44AEF20B67CD7F00BAD059 /* filesrch.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = filesrch.h; path = ../../filesrch.h; sourceTree = SOURCE_ROOT; }; + 1E44AEF50B67CD9F00BAD059 /* keys.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = keys.h; path = ../../keys.h; sourceTree = SOURCE_ROOT; }; + 1E44AEF80B67CDE900BAD059 /* m_argv.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_argv.c; path = ../../m_argv.c; sourceTree = SOURCE_ROOT; }; + 1E44AEF90B67CDE900BAD059 /* m_bbox.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_bbox.h; path = ../../m_bbox.h; sourceTree = SOURCE_ROOT; }; + 1E44AEFA0B67CDE900BAD059 /* m_argv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_argv.h; path = ../../m_argv.h; sourceTree = SOURCE_ROOT; }; + 1E44AEFB0B67CDE900BAD059 /* m_cheat.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_cheat.c; path = ../../m_cheat.c; sourceTree = SOURCE_ROOT; }; + 1E44AEFC0B67CDE900BAD059 /* m_bbox.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_bbox.c; path = ../../m_bbox.c; sourceTree = SOURCE_ROOT; }; + 1E44AEFD0B67CDE900BAD059 /* m_cheat.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_cheat.h; path = ../../m_cheat.h; sourceTree = SOURCE_ROOT; }; + 1E44AEFE0B67CDE900BAD059 /* m_fixed.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_fixed.c; path = ../../m_fixed.c; sourceTree = SOURCE_ROOT; }; + 1E44AEFF0B67CDE900BAD059 /* m_fixed.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_fixed.h; path = ../../m_fixed.h; sourceTree = SOURCE_ROOT; }; + 1E44AF000B67CDE900BAD059 /* m_menu.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_menu.c; path = ../../m_menu.c; sourceTree = SOURCE_ROOT; }; + 1E44AF010B67CDE900BAD059 /* m_menu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_menu.h; path = ../../m_menu.h; sourceTree = SOURCE_ROOT; }; + 1E44AF020B67CDE900BAD059 /* m_misc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_misc.c; path = ../../m_misc.c; sourceTree = SOURCE_ROOT; }; + 1E44AF030B67CDE900BAD059 /* m_misc.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_misc.h; path = ../../m_misc.h; sourceTree = SOURCE_ROOT; }; + 1E44AF040B67CDE900BAD059 /* m_random.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_random.c; path = ../../m_random.c; sourceTree = SOURCE_ROOT; }; + 1E44AF050B67CDE900BAD059 /* m_random.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_random.h; path = ../../m_random.h; sourceTree = SOURCE_ROOT; }; + 1E44AF060B67CDE900BAD059 /* m_swap.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_swap.h; path = ../../m_swap.h; sourceTree = SOURCE_ROOT; }; + 1E44AF180B67CE2A00BAD059 /* info.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = info.c; path = ../../info.c; sourceTree = SOURCE_ROOT; }; + 1E44AF190B67CE2A00BAD059 /* info.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = info.h; path = ../../info.h; sourceTree = SOURCE_ROOT; }; + 1E44AF1C0B67CE3600BAD059 /* md5.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = md5.c; path = ../../md5.c; sourceTree = SOURCE_ROOT; }; + 1E44AF1D0B67CE3600BAD059 /* md5.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = md5.h; path = ../../md5.h; sourceTree = SOURCE_ROOT; }; + 1E44AF200B67CE4100BAD059 /* mserv.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = mserv.c; path = ../../mserv.c; sourceTree = SOURCE_ROOT; }; + 1E44AF210B67CE4100BAD059 /* mserv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = mserv.h; path = ../../mserv.h; sourceTree = SOURCE_ROOT; }; + 1E44AF240B67CE5F00BAD059 /* p_enemy.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_enemy.c; path = ../../p_enemy.c; sourceTree = SOURCE_ROOT; }; + 1E44AF250B67CE5F00BAD059 /* p_inter.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_inter.c; path = ../../p_inter.c; sourceTree = SOURCE_ROOT; }; + 1E44AF260B67CE5F00BAD059 /* p_fab.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_fab.c; path = ../../p_fab.c; sourceTree = SOURCE_ROOT; }; + 1E44AF270B67CE5F00BAD059 /* p_lights.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_lights.c; path = ../../p_lights.c; sourceTree = SOURCE_ROOT; }; + 1E44AF280B67CE5F00BAD059 /* p_map.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_map.c; path = ../../p_map.c; sourceTree = SOURCE_ROOT; }; + 1E44AF290B67CE5F00BAD059 /* p_maputl.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_maputl.c; path = ../../p_maputl.c; sourceTree = SOURCE_ROOT; }; + 1E44AF2A0B67CE5F00BAD059 /* p_maputl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = p_maputl.h; path = ../../p_maputl.h; sourceTree = SOURCE_ROOT; }; + 1E44AF2B0B67CE5F00BAD059 /* p_mobj.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_mobj.c; path = ../../p_mobj.c; sourceTree = SOURCE_ROOT; }; + 1E44AF2C0B67CE5F00BAD059 /* p_mobj.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = p_mobj.h; path = ../../p_mobj.h; sourceTree = SOURCE_ROOT; }; + 1E44AF2D0B67CE5F00BAD059 /* p_floor.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_floor.c; path = ../../p_floor.c; sourceTree = SOURCE_ROOT; }; + 1E44AF2E0B67CE5F00BAD059 /* p_local.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = p_local.h; path = ../../p_local.h; sourceTree = SOURCE_ROOT; }; + 1E44AF2F0B67CE5F00BAD059 /* p_pspr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = p_pspr.h; path = ../../p_pspr.h; sourceTree = SOURCE_ROOT; }; + 1E44AF300B67CE5F00BAD059 /* p_saveg.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_saveg.c; path = ../../p_saveg.c; sourceTree = SOURCE_ROOT; }; + 1E44AF310B67CE5F00BAD059 /* p_saveg.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = p_saveg.h; path = ../../p_saveg.h; sourceTree = SOURCE_ROOT; }; + 1E44AF320B67CE5F00BAD059 /* p_setup.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_setup.c; path = ../../p_setup.c; sourceTree = SOURCE_ROOT; }; + 1E44AF330B67CE5F00BAD059 /* p_setup.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = p_setup.h; path = ../../p_setup.h; sourceTree = SOURCE_ROOT; }; + 1E44AF340B67CE5F00BAD059 /* p_sight.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_sight.c; path = ../../p_sight.c; sourceTree = SOURCE_ROOT; }; + 1E44AF350B67CE5F00BAD059 /* p_spec.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_spec.c; path = ../../p_spec.c; sourceTree = SOURCE_ROOT; }; + 1E44AF360B67CE5F00BAD059 /* p_spec.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = p_spec.h; path = ../../p_spec.h; sourceTree = SOURCE_ROOT; }; + 1E44AF370B67CE5F00BAD059 /* p_telept.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_telept.c; path = ../../p_telept.c; sourceTree = SOURCE_ROOT; }; + 1E44AF380B67CE5F00BAD059 /* p_tick.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_tick.c; path = ../../p_tick.c; sourceTree = SOURCE_ROOT; }; + 1E44AF390B67CE5F00BAD059 /* p_tick.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = p_tick.h; path = ../../p_tick.h; sourceTree = SOURCE_ROOT; }; + 1E44AF3A0B67CE5F00BAD059 /* p_user.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_user.c; path = ../../p_user.c; sourceTree = SOURCE_ROOT; }; + 1E44AF3B0B67CE5F00BAD059 /* p_ceilng.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_ceilng.c; path = ../../p_ceilng.c; sourceTree = SOURCE_ROOT; }; + 1E44AF550B67CEC100BAD059 /* r_bsp.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_bsp.c; path = ../../r_bsp.c; sourceTree = SOURCE_ROOT; }; + 1E44AF560B67CEC100BAD059 /* r_bsp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_bsp.h; path = ../../r_bsp.h; sourceTree = SOURCE_ROOT; }; + 1E44AF570B67CEC100BAD059 /* r_defs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_defs.h; path = ../../r_defs.h; sourceTree = SOURCE_ROOT; }; + 1E44AF580B67CEC100BAD059 /* r_data.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_data.c; path = ../../r_data.c; sourceTree = SOURCE_ROOT; }; + 1E44AF590B67CEC100BAD059 /* r_draw.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_draw.c; path = ../../r_draw.c; sourceTree = SOURCE_ROOT; }; + 1E44AF5A0B67CEC100BAD059 /* r_draw16.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_draw16.c; path = ../../r_draw16.c; sourceTree = SOURCE_ROOT; }; + 1E44AF5B0B67CEC100BAD059 /* r_draw8.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_draw8.c; path = ../../r_draw8.c; sourceTree = SOURCE_ROOT; }; + 1E44AF5C0B67CEC100BAD059 /* r_main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_main.c; path = ../../r_main.c; sourceTree = SOURCE_ROOT; }; + 1E44AF5D0B67CEC100BAD059 /* r_main.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_main.h; path = ../../r_main.h; sourceTree = SOURCE_ROOT; }; + 1E44AF5E0B67CEC100BAD059 /* r_data.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_data.h; path = ../../r_data.h; sourceTree = SOURCE_ROOT; }; + 1E44AF5F0B67CEC100BAD059 /* r_draw.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_draw.h; path = ../../r_draw.h; sourceTree = SOURCE_ROOT; }; + 1E44AF600B67CEC100BAD059 /* r_local.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_local.h; path = ../../r_local.h; sourceTree = SOURCE_ROOT; }; + 1E44AF610B67CEC100BAD059 /* r_plane.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_plane.c; path = ../../r_plane.c; sourceTree = SOURCE_ROOT; }; + 1E44AF620B67CEC100BAD059 /* r_plane.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_plane.h; path = ../../r_plane.h; sourceTree = SOURCE_ROOT; }; + 1E44AF630B67CEC100BAD059 /* r_segs.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_segs.c; path = ../../r_segs.c; sourceTree = SOURCE_ROOT; }; + 1E44AF640B67CEC100BAD059 /* r_segs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_segs.h; path = ../../r_segs.h; sourceTree = SOURCE_ROOT; }; + 1E44AF650B67CEC200BAD059 /* r_sky.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_sky.c; path = ../../r_sky.c; sourceTree = SOURCE_ROOT; }; + 1E44AF660B67CEC200BAD059 /* r_sky.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_sky.h; path = ../../r_sky.h; sourceTree = SOURCE_ROOT; }; + 1E44AF670B67CEC200BAD059 /* r_splats.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_splats.c; path = ../../r_splats.c; sourceTree = SOURCE_ROOT; }; + 1E44AF680B67CEC200BAD059 /* r_splats.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_splats.h; path = ../../r_splats.h; sourceTree = SOURCE_ROOT; }; + 1E44AF690B67CEC200BAD059 /* r_state.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_state.h; path = ../../r_state.h; sourceTree = SOURCE_ROOT; }; + 1E44AF6A0B67CEC200BAD059 /* r_things.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_things.c; path = ../../r_things.c; sourceTree = SOURCE_ROOT; }; + 1E44AF6B0B67CEC200BAD059 /* r_things.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_things.h; path = ../../r_things.h; sourceTree = SOURCE_ROOT; }; + 1E44AF850B67CEE000BAD059 /* s_sound.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = s_sound.c; path = ../../s_sound.c; sourceTree = SOURCE_ROOT; }; + 1E44AF860B67CEE000BAD059 /* s_sound.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = s_sound.h; path = ../../s_sound.h; sourceTree = SOURCE_ROOT; }; + 1E44AF890B67CEE900BAD059 /* screen.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = screen.c; path = ../../screen.c; sourceTree = SOURCE_ROOT; }; + 1E44AF8A0B67CEE900BAD059 /* screen.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = screen.h; path = ../../screen.h; sourceTree = SOURCE_ROOT; }; + 1E44AF8D0B67CEF000BAD059 /* sounds.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = sounds.c; path = ../../sounds.c; sourceTree = SOURCE_ROOT; }; + 1E44AF8E0B67CEF000BAD059 /* sounds.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sounds.h; path = ../../sounds.h; sourceTree = SOURCE_ROOT; }; + 1E44AF910B67CEFF00BAD059 /* st_stuff.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = st_stuff.c; path = ../../st_stuff.c; sourceTree = SOURCE_ROOT; }; + 1E44AF920B67CEFF00BAD059 /* st_stuff.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = st_stuff.h; path = ../../st_stuff.h; sourceTree = SOURCE_ROOT; }; + 1E44AF950B67CF1300BAD059 /* string.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = string.c; path = ../../string.c; sourceTree = SOURCE_ROOT; }; + 1E44AF990B67CF2E00BAD059 /* tables.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = tables.c; path = ../../tables.c; sourceTree = SOURCE_ROOT; }; + 1E44AF9A0B67CF2E00BAD059 /* tables.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = tables.h; path = ../../tables.h; sourceTree = SOURCE_ROOT; }; + 1E44AF9D0B67CF3D00BAD059 /* tmap.nas */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = tmap.nas; path = ../../tmap.nas; sourceTree = SOURCE_ROOT; }; + 1E44AF9F0B67CF4900BAD059 /* tmap_mmx.nas */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = tmap_mmx.nas; path = ../../tmap_mmx.nas; sourceTree = SOURCE_ROOT; }; + 1E44AFA00B67CF4900BAD059 /* tmap_vc.nas */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = tmap_vc.nas; path = ../../tmap_vc.nas; sourceTree = SOURCE_ROOT; }; + 1E44AFA30B67CF5D00BAD059 /* v_video.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = v_video.c; path = ../../v_video.c; sourceTree = SOURCE_ROOT; }; + 1E44AFA40B67CF5D00BAD059 /* v_video.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = v_video.h; path = ../../v_video.h; sourceTree = SOURCE_ROOT; }; + 1E44AFA70B67CF6400BAD059 /* w_wad.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = w_wad.c; path = ../../w_wad.c; sourceTree = SOURCE_ROOT; }; + 1E44AFA80B67CF6400BAD059 /* w_wad.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = w_wad.h; path = ../../w_wad.h; sourceTree = SOURCE_ROOT; }; + 1E44AFAB0B67CF6F00BAD059 /* y_inter.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = y_inter.c; path = ../../y_inter.c; sourceTree = SOURCE_ROOT; }; + 1E44AFAC0B67CF6F00BAD059 /* y_inter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = y_inter.h; path = ../../y_inter.h; sourceTree = SOURCE_ROOT; }; + 1E44AFAF0B67CF7A00BAD059 /* z_zone.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = z_zone.c; path = ../../z_zone.c; sourceTree = SOURCE_ROOT; }; + 1E44AFB00B67CF7A00BAD059 /* z_zone.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = z_zone.h; path = ../../z_zone.h; sourceTree = SOURCE_ROOT; }; + 1E44AFB40B67CFDC00BAD059 /* dosstr.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dosstr.c; path = ../dosstr.c; sourceTree = SOURCE_ROOT; }; + 1E44AFB50B67CFDC00BAD059 /* endtxt.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = endtxt.c; path = ../endtxt.c; sourceTree = SOURCE_ROOT; }; + 1E44AFB60B67CFDC00BAD059 /* endtxt.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = endtxt.h; path = ../endtxt.h; sourceTree = SOURCE_ROOT; }; + 1E44AFB70B67CFDC00BAD059 /* hwsym_sdl.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hwsym_sdl.c; path = ../hwsym_sdl.c; sourceTree = SOURCE_ROOT; }; + 1E44AFB80B67CFDC00BAD059 /* hwsym_sdl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hwsym_sdl.h; path = ../hwsym_sdl.h; sourceTree = SOURCE_ROOT; }; + 1E44AFB90B67CFDC00BAD059 /* i_cdmus.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = i_cdmus.c; path = ../i_cdmus.c; sourceTree = SOURCE_ROOT; }; + 1E44AFBA0B67CFDC00BAD059 /* i_main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = i_main.c; path = ../i_main.c; sourceTree = SOURCE_ROOT; }; + 1E44AFBB0B67CFDC00BAD059 /* i_net.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = i_net.c; path = ../i_net.c; sourceTree = SOURCE_ROOT; }; + 1E44AFBD0B67CFDC00BAD059 /* i_system.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = i_system.c; path = ../i_system.c; sourceTree = SOURCE_ROOT; }; + 1E44AFBE0B67CFDC00BAD059 /* i_video.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = i_video.c; path = ../i_video.c; sourceTree = SOURCE_ROOT; }; + 1E44AFBF0B67CFDC00BAD059 /* IMG_xpm.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = IMG_xpm.c; path = ../IMG_xpm.c; sourceTree = SOURCE_ROOT; }; + 1E44AFC00B67CFDC00BAD059 /* ogl_sdl.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ogl_sdl.c; path = ../ogl_sdl.c; sourceTree = SOURCE_ROOT; }; + 1E44AFC10B67CFDC00BAD059 /* ogl_sdl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ogl_sdl.h; path = ../ogl_sdl.h; sourceTree = SOURCE_ROOT; }; + 1E44AFC20B67CFDC00BAD059 /* SDL_icon.xpm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = SDL_icon.xpm; path = ../SDL_icon.xpm; sourceTree = SOURCE_ROOT; }; + 1E44AFC30B67CFDC00BAD059 /* sdlmain.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sdlmain.h; path = ../sdlmain.h; sourceTree = SOURCE_ROOT; }; + 1E44AFD50B67D03100BAD059 /* filters.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = filters.c; path = ../filter/filters.c; sourceTree = SOURCE_ROOT; }; + 1E44AFD60B67D03100BAD059 /* filters.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = filters.h; path = ../filter/filters.h; sourceTree = SOURCE_ROOT; }; + 1E44AFD70B67D03100BAD059 /* hq2x.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hq2x.c; path = ../filter/hq2x.c; sourceTree = SOURCE_ROOT; }; + 1E44AFD80B67D03100BAD059 /* hq2x.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hq2x.h; path = ../filter/hq2x.h; sourceTree = SOURCE_ROOT; }; + 1E44AFD90B67D03100BAD059 /* interp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = interp.h; path = ../filter/interp.h; sourceTree = SOURCE_ROOT; }; + 1E44AFDA0B67D03100BAD059 /* lq2x.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = lq2x.c; path = ../filter/lq2x.c; sourceTree = SOURCE_ROOT; }; + 1E44AFDB0B67D03100BAD059 /* lq2x.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = lq2x.h; path = ../filter/lq2x.h; sourceTree = SOURCE_ROOT; }; + 1E44AFDC0B67D03100BAD059 /* main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = main.c; path = ../filter/main.c; sourceTree = SOURCE_ROOT; }; + 1E44AFE60B67D06200BAD059 /* mac_alert.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = mac_alert.h; sourceTree = SOURCE_ROOT; }; + 1E44AFE70B67D06200BAD059 /* Srb2mac.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Srb2mac.icns; sourceTree = SOURCE_ROOT; }; + 1E44AFE80B67D06200BAD059 /* mac_alert.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = mac_alert.c; sourceTree = SOURCE_ROOT; }; + 1E44AFEC0B67D0AB00BAD059 /* r_opengl.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_opengl.c; path = ../../hardware/r_opengl/r_opengl.c; sourceTree = SOURCE_ROOT; }; + 1E44B0560B67D81E00BAD059 /* SDL_macosx_main.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_macosx_main.h; path = ../SDL_main/SDL_macosx_main.h; sourceTree = SOURCE_ROOT; }; + 1E44B0570B67D81E00BAD059 /* SDL_macosx_main.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = SDL_macosx_main.m; path = ../SDL_main/SDL_macosx_main.m; sourceTree = SOURCE_ROOT; }; + 1E44B2240B67EADE00BAD059 /* lzf.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = lzf.c; path = ../../lzf.c; sourceTree = SOURCE_ROOT; }; + 1E44B2250B67EADE00BAD059 /* lzf.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = lzf.h; path = ../../lzf.h; sourceTree = SOURCE_ROOT; }; + 1E66921B0B690C5B00B7313A /* SDL_mixer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL_mixer.framework; path = /Library/Frameworks/SDL_mixer.framework; sourceTree = ""; }; + 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 67259DFA18D2687D00F02971 /* lua_hud.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lua_hud.h; path = ../../lua_hud.h; sourceTree = SOURCE_ROOT; }; + 67259DFB18D2687D00F02971 /* lua_hudlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_hudlib.c; path = ../../lua_hudlib.c; sourceTree = SOURCE_ROOT; }; + 67259DFC18D2687D00F02971 /* lua_skinlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_skinlib.c; path = ../../lua_skinlib.c; sourceTree = SOURCE_ROOT; }; + 67259DFF18D268AE00F02971 /* m_anigif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = m_anigif.c; path = ../../m_anigif.c; sourceTree = SOURCE_ROOT; }; + 67259E0018D268AE00F02971 /* m_anigif.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = m_anigif.h; path = ../../m_anigif.h; sourceTree = SOURCE_ROOT; }; + 67259E0218D268F600F02971 /* i_ttf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = i_ttf.c; path = ../i_ttf.c; sourceTree = SOURCE_ROOT; }; + 67259E0318D268F600F02971 /* i_ttf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = i_ttf.h; path = ../i_ttf.h; sourceTree = SOURCE_ROOT; }; + 67259E0418D268F600F02971 /* mixer_sound.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mixer_sound.c; path = ../mixer_sound.c; sourceTree = SOURCE_ROOT; }; + 67259E0518D268F600F02971 /* sdl_sound.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sdl_sound.c; path = ../sdl_sound.c; sourceTree = SOURCE_ROOT; }; + 67259E2B18D26D5700F02971 /* patch.dta */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = patch.dta; path = ../../../bin/Resources/patch.dta; sourceTree = SOURCE_ROOT; }; + 67259E2C18D26D5700F02971 /* rings.dta */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = rings.dta; path = ../../../bin/Resources/rings.dta; sourceTree = SOURCE_ROOT; }; + 67259E2D18D26D5700F02971 /* srb2.srb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = srb2.srb; path = ../../../bin/Resources/srb2.srb; sourceTree = SOURCE_ROOT; }; + 6766C0AE11B057E50065F389 /* zones.dta */ = {isa = PBXFileReference; lastKnownFileType = text; name = zones.dta; path = ../../../bin/Resources/zones.dta; sourceTree = SOURCE_ROOT; }; + 676BB51C0E0DE06100C95963 /* m_queue.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = m_queue.c; path = ../../m_queue.c; sourceTree = SOURCE_ROOT; }; + 676BB51D0E0DE06100C95963 /* m_queue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = m_queue.h; path = ../../m_queue.h; sourceTree = SOURCE_ROOT; }; + 676BB51E0E0DE06100C95963 /* p_polyobj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = p_polyobj.c; path = ../../p_polyobj.c; sourceTree = SOURCE_ROOT; }; + 676BB51F0E0DE06100C95963 /* p_polyobj.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = p_polyobj.h; path = ../../p_polyobj.h; sourceTree = SOURCE_ROOT; }; + 67A1F91813FAD026009FA3E5 /* player.dta */ = {isa = PBXFileReference; lastKnownFileType = text; name = player.dta; path = ../../../bin/Resources/player.dta; sourceTree = SOURCE_ROOT; }; + 67B2071C1180FA8200E93654 /* vid_copy.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = vid_copy.s; path = ../../vid_copy.s; sourceTree = SOURCE_ROOT; }; + 67B83BCB14F57EAB00AAAE4E /* lapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lapi.c; path = ../../blua/lapi.c; sourceTree = SOURCE_ROOT; }; + 67B83BCC14F57EAB00AAAE4E /* lapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lapi.h; path = ../../blua/lapi.h; sourceTree = SOURCE_ROOT; }; + 67B83BCD14F57EAB00AAAE4E /* lauxlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lauxlib.c; path = ../../blua/lauxlib.c; sourceTree = SOURCE_ROOT; }; + 67B83BCE14F57EAB00AAAE4E /* lauxlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lauxlib.h; path = ../../blua/lauxlib.h; sourceTree = SOURCE_ROOT; }; + 67B83BCF14F57EAB00AAAE4E /* lbaselib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lbaselib.c; path = ../../blua/lbaselib.c; sourceTree = SOURCE_ROOT; }; + 67B83BD014F57EAB00AAAE4E /* lcode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lcode.c; path = ../../blua/lcode.c; sourceTree = SOURCE_ROOT; }; + 67B83BD114F57EAB00AAAE4E /* lcode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lcode.h; path = ../../blua/lcode.h; sourceTree = SOURCE_ROOT; }; + 67B83BD214F57EAB00AAAE4E /* ldebug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ldebug.c; path = ../../blua/ldebug.c; sourceTree = SOURCE_ROOT; }; + 67B83BD314F57EAB00AAAE4E /* ldebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ldebug.h; path = ../../blua/ldebug.h; sourceTree = SOURCE_ROOT; }; + 67B83BD414F57EAB00AAAE4E /* ldo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ldo.c; path = ../../blua/ldo.c; sourceTree = SOURCE_ROOT; }; + 67B83BD514F57EAB00AAAE4E /* ldo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ldo.h; path = ../../blua/ldo.h; sourceTree = SOURCE_ROOT; }; + 67B83BD614F57EAB00AAAE4E /* ldump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ldump.c; path = ../../blua/ldump.c; sourceTree = SOURCE_ROOT; }; + 67B83BD714F57EAB00AAAE4E /* lfunc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lfunc.c; path = ../../blua/lfunc.c; sourceTree = SOURCE_ROOT; }; + 67B83BD814F57EAB00AAAE4E /* lfunc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lfunc.h; path = ../../blua/lfunc.h; sourceTree = SOURCE_ROOT; }; + 67B83BD914F57EAB00AAAE4E /* lgc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lgc.c; path = ../../blua/lgc.c; sourceTree = SOURCE_ROOT; }; + 67B83BDA14F57EAB00AAAE4E /* lgc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lgc.h; path = ../../blua/lgc.h; sourceTree = SOURCE_ROOT; }; + 67B83BDB14F57EAB00AAAE4E /* linit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = linit.c; path = ../../blua/linit.c; sourceTree = SOURCE_ROOT; }; + 67B83BDC14F57EAB00AAAE4E /* llex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = llex.c; path = ../../blua/llex.c; sourceTree = SOURCE_ROOT; }; + 67B83BDD14F57EAB00AAAE4E /* llex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = llex.h; path = ../../blua/llex.h; sourceTree = SOURCE_ROOT; }; + 67B83BDE14F57EAB00AAAE4E /* llimits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = llimits.h; path = ../../blua/llimits.h; sourceTree = SOURCE_ROOT; }; + 67B83BDF14F57EAB00AAAE4E /* lmem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lmem.c; path = ../../blua/lmem.c; sourceTree = SOURCE_ROOT; }; + 67B83BE014F57EAB00AAAE4E /* lmem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lmem.h; path = ../../blua/lmem.h; sourceTree = SOURCE_ROOT; }; + 67B83BE114F57EAB00AAAE4E /* lobject.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lobject.c; path = ../../blua/lobject.c; sourceTree = SOURCE_ROOT; }; + 67B83BE214F57EAB00AAAE4E /* lobject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lobject.h; path = ../../blua/lobject.h; sourceTree = SOURCE_ROOT; }; + 67B83BE314F57EAB00AAAE4E /* lopcodes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lopcodes.c; path = ../../blua/lopcodes.c; sourceTree = SOURCE_ROOT; }; + 67B83BE414F57EAB00AAAE4E /* lopcodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lopcodes.h; path = ../../blua/lopcodes.h; sourceTree = SOURCE_ROOT; }; + 67B83BE514F57EAB00AAAE4E /* lparser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lparser.c; path = ../../blua/lparser.c; sourceTree = SOURCE_ROOT; }; + 67B83BE614F57EAB00AAAE4E /* lparser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lparser.h; path = ../../blua/lparser.h; sourceTree = SOURCE_ROOT; }; + 67B83BE714F57EAB00AAAE4E /* lstate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lstate.c; path = ../../blua/lstate.c; sourceTree = SOURCE_ROOT; }; + 67B83BE814F57EAB00AAAE4E /* lstate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lstate.h; path = ../../blua/lstate.h; sourceTree = SOURCE_ROOT; }; + 67B83BE914F57EAB00AAAE4E /* lstring.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lstring.c; path = ../../blua/lstring.c; sourceTree = SOURCE_ROOT; }; + 67B83BEA14F57EAB00AAAE4E /* lstring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lstring.h; path = ../../blua/lstring.h; sourceTree = SOURCE_ROOT; }; + 67B83BEB14F57EAB00AAAE4E /* lstrlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lstrlib.c; path = ../../blua/lstrlib.c; sourceTree = SOURCE_ROOT; }; + 67B83BEC14F57EAB00AAAE4E /* ltable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ltable.c; path = ../../blua/ltable.c; sourceTree = SOURCE_ROOT; }; + 67B83BED14F57EAB00AAAE4E /* ltable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ltable.h; path = ../../blua/ltable.h; sourceTree = SOURCE_ROOT; }; + 67B83BEE14F57EAB00AAAE4E /* ltablib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ltablib.c; path = ../../blua/ltablib.c; sourceTree = SOURCE_ROOT; }; + 67B83BEF14F57EAB00AAAE4E /* ltm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ltm.c; path = ../../blua/ltm.c; sourceTree = SOURCE_ROOT; }; + 67B83BF014F57EAB00AAAE4E /* ltm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ltm.h; path = ../../blua/ltm.h; sourceTree = SOURCE_ROOT; }; + 67B83BF114F57EAB00AAAE4E /* lua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lua.h; path = ../../blua/lua.h; sourceTree = SOURCE_ROOT; }; + 67B83BF214F57EAB00AAAE4E /* luaconf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = luaconf.h; path = ../../blua/luaconf.h; sourceTree = SOURCE_ROOT; }; + 67B83BF314F57EAB00AAAE4E /* lualib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lualib.h; path = ../../blua/lualib.h; sourceTree = SOURCE_ROOT; }; + 67B83BF414F57EAB00AAAE4E /* lundump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lundump.c; path = ../../blua/lundump.c; sourceTree = SOURCE_ROOT; }; + 67B83BF514F57EAB00AAAE4E /* lundump.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lundump.h; path = ../../blua/lundump.h; sourceTree = SOURCE_ROOT; }; + 67B83BF614F57EAB00AAAE4E /* lvm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lvm.c; path = ../../blua/lvm.c; sourceTree = SOURCE_ROOT; }; + 67B83BF714F57EAB00AAAE4E /* lvm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lvm.h; path = ../../blua/lvm.h; sourceTree = SOURCE_ROOT; }; + 67B83BF814F57EAB00AAAE4E /* lzio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lzio.c; path = ../../blua/lzio.c; sourceTree = SOURCE_ROOT; }; + 67B83BF914F57EAB00AAAE4E /* lzio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lzio.h; path = ../../blua/lzio.h; sourceTree = SOURCE_ROOT; }; + 67B83C1214F57ECA00AAAE4E /* b_bot.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = b_bot.c; path = ../../b_bot.c; sourceTree = SOURCE_ROOT; }; + 67B83C1314F57ECA00AAAE4E /* b_bot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = b_bot.h; path = ../../b_bot.h; sourceTree = SOURCE_ROOT; }; + 67B83C1514F57EE600AAAE4E /* lua_baselib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_baselib.c; path = ../../lua_baselib.c; sourceTree = SOURCE_ROOT; }; + 67B83C1614F57EE600AAAE4E /* lua_consolelib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_consolelib.c; path = ../../lua_consolelib.c; sourceTree = SOURCE_ROOT; }; + 67B83C1714F57EE600AAAE4E /* lua_hook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lua_hook.h; path = ../../lua_hook.h; sourceTree = SOURCE_ROOT; }; + 67B83C1814F57EE600AAAE4E /* lua_hooklib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_hooklib.c; path = ../../lua_hooklib.c; sourceTree = SOURCE_ROOT; }; + 67B83C1914F57EE600AAAE4E /* lua_infolib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_infolib.c; path = ../../lua_infolib.c; sourceTree = SOURCE_ROOT; }; + 67B83C1A14F57EE600AAAE4E /* lua_libs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lua_libs.h; path = ../../lua_libs.h; sourceTree = SOURCE_ROOT; }; + 67B83C1B14F57EE600AAAE4E /* lua_maplib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_maplib.c; path = ../../lua_maplib.c; sourceTree = SOURCE_ROOT; }; + 67B83C1C14F57EE600AAAE4E /* lua_mathlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_mathlib.c; path = ../../lua_mathlib.c; sourceTree = SOURCE_ROOT; }; + 67B83C1D14F57EE600AAAE4E /* lua_mobjlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_mobjlib.c; path = ../../lua_mobjlib.c; sourceTree = SOURCE_ROOT; }; + 67B83C1E14F57EE600AAAE4E /* lua_playerlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_playerlib.c; path = ../../lua_playerlib.c; sourceTree = SOURCE_ROOT; }; + 67B83C1F14F57EE600AAAE4E /* lua_script.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_script.c; path = ../../lua_script.c; sourceTree = SOURCE_ROOT; }; + 67B83C2014F57EE600AAAE4E /* lua_script.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lua_script.h; path = ../../lua_script.h; sourceTree = SOURCE_ROOT; }; + 67B83C2114F57EE600AAAE4E /* lua_thinkerlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_thinkerlib.c; path = ../../lua_thinkerlib.c; sourceTree = SOURCE_ROOT; }; + 67B83C2C14F57F1500AAAE4E /* fastcmp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fastcmp.h; path = ../../fastcmp.h; sourceTree = SOURCE_ROOT; }; + 67B83C2D14F57F1500AAAE4E /* i_addrinfo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = i_addrinfo.c; path = ../../i_addrinfo.c; sourceTree = SOURCE_ROOT; }; + 67B83C2E14F57F1500AAAE4E /* i_addrinfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = i_addrinfo.h; path = ../../i_addrinfo.h; sourceTree = SOURCE_ROOT; }; + 67B83C2F14F57F1500AAAE4E /* m_cond.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = m_cond.c; path = ../../m_cond.c; sourceTree = SOURCE_ROOT; }; + 67B83C3014F57F1500AAAE4E /* m_cond.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = m_cond.h; path = ../../m_cond.h; sourceTree = SOURCE_ROOT; }; + 67B83C3114F57F1500AAAE4E /* m_dllist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = m_dllist.h; path = ../../m_dllist.h; sourceTree = SOURCE_ROOT; }; + 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; + 8D1107320486CEB800E47090 /* Srb2mac.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Srb2mac.app; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8D11072E0486CEB800E47090 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 002F39FA09D0881F00EBEB88 /* SDL.framework in Frameworks */, + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, + 1E66921C0B690C5B00B7313A /* SDL_mixer.framework in Frameworks */, + 1E32C4290B6E6D5D0029E058 /* libpng.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 080E96DDFE201D6D7F000001 /* Classes */ = { + isa = PBXGroup; + children = ( + 1E44AE890B67CC4E00BAD059 /* A_Asm */, + 67B83BCA14F57DD400AAAE4E /* B_Bot */, + 67B83BC914F57D7F00AAAE4E /* BLUA */, + 1E44AE8C0B67CC6500BAD059 /* D_Doom */, + 1E44AEBB0B67CC9800BAD059 /* F_Frame */, + 1E44AEC20B67CCB500BAD059 /* G_Game */, + 1E44AECD0B67CCD200BAD059 /* H_Hud */, + 1E44AE5C0B67CC0F00BAD059 /* Hw_Hardware */, + 1E44AED20B67CCF600BAD059 /* I_Interface */, + 67B83BC814F57D6E00AAAE4E /* LUA */, + 1E44AEF70B67CDA900BAD059 /* M_Misc */, + 1E44AF160B67CDFB00BAD059 /* P_Play */, + 1E44AF540B67CE8C00BAD059 /* R_Render */, + 1E44AF830B67CEC900BAD059 /* S_Sound */, + 1E44AF170B67CE1000BAD059 /* W_Wad */, + ); + name = Classes; + sourceTree = ""; + }; + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { + isa = PBXGroup; + children = ( + 1E32C4140B6E6D5D0029E058 /* libpng.framework */, + 1E66921B0B690C5B00B7313A /* SDL_mixer.framework */, + 002F39F909D0881F00EBEB88 /* SDL.framework */, + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, + ); + name = "Linked Frameworks"; + sourceTree = ""; + }; + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 29B97324FDCFA39411CA2CEA /* AppKit.framework */, + 29B97325FDCFA39411CA2CEA /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8D1107320486CEB800E47090 /* Srb2mac.app */, + ); + name = Products; + sourceTree = ""; + }; + 1E44AE5C0B67CC0F00BAD059 /* Hw_Hardware */ = { + isa = PBXGroup; + children = ( + 1E44AE600B67CC2B00BAD059 /* hw3dsdrv.h */, + 1E44AE610B67CC2B00BAD059 /* hw_bsp.c */, + 1E44AE620B67CC2B00BAD059 /* hw_defs.h */, + 1E44AE630B67CC2B00BAD059 /* hw3sound.c */, + 1E44AE640B67CC2B00BAD059 /* hw_cache.c */, + 1E44AE650B67CC2B00BAD059 /* hw_dll.h */, + 1E44AE660B67CC2B00BAD059 /* hw_drv.h */, + 1E44AE670B67CC2B00BAD059 /* hw_glide.h */, + 1E44AE680B67CC2B00BAD059 /* hw_light.c */, + 1E44AE690B67CC2B00BAD059 /* hw_light.h */, + 1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */, + 1E44AE6B0B67CC2B00BAD059 /* hw_data.h */, + 1E44AE6C0B67CC2B00BAD059 /* hw_draw.c */, + 1E44AE6D0B67CC2B00BAD059 /* hw_glob.h */, + 1E44AE6E0B67CC2B00BAD059 /* hw_main.c */, + 1E44AE6F0B67CC2B00BAD059 /* hw_main.h */, + 1E44AE700B67CC2B00BAD059 /* hw_md2.c */, + 1E44AE710B67CC2B00BAD059 /* hw_md2.h */, + 1E44AE720B67CC2B00BAD059 /* hw_trick.c */, + 1E44AE730B67CC2B00BAD059 /* hws_data.h */, + ); + name = Hw_Hardware; + sourceTree = ""; + }; + 1E44AE890B67CC4E00BAD059 /* A_Asm */ = { + isa = PBXGroup; + children = ( + 67B2071C1180FA8200E93654 /* vid_copy.s */, + 1E44AE8A0B67CC6000BAD059 /* asm_defs.inc */, + 1E44AF9D0B67CF3D00BAD059 /* tmap.nas */, + 1E44AF9F0B67CF4900BAD059 /* tmap_mmx.nas */, + 1E44AFA00B67CF4900BAD059 /* tmap_vc.nas */, + ); + name = A_Asm; + sourceTree = ""; + }; + 1E44AE8C0B67CC6500BAD059 /* D_Doom */ = { + isa = PBXGroup; + children = ( + 1E44AEEB0B67CD4400BAD059 /* comptime.c */, + 1E44AE8D0B67CC8400BAD059 /* d_clisrv.c */, + 1E44AE8E0B67CC8400BAD059 /* d_clisrv.h */, + 1E44AE8F0B67CC8400BAD059 /* d_event.h */, + 1E44AE900B67CC8400BAD059 /* d_main.c */, + 1E44AE910B67CC8500BAD059 /* d_net.c */, + 1E44AE920B67CC8500BAD059 /* d_net.h */, + 1E44AE930B67CC8500BAD059 /* d_netcmd.h */, + 1E44AE940B67CC8500BAD059 /* d_netfil.c */, + 1E44AE950B67CC8500BAD059 /* d_player.h */, + 1E44AE960B67CC8500BAD059 /* d_think.h */, + 1E44AE980B67CC8500BAD059 /* d_netcmd.c */, + 1E44AE990B67CC8500BAD059 /* d_ticcmd.h */, + 1E44AE9A0B67CC8500BAD059 /* d_main.h */, + 1E44AE9B0B67CC8500BAD059 /* d_netfil.h */, + 1E44AE9C0B67CC8500BAD059 /* dehacked.c */, + 1E44AE9D0B67CC8500BAD059 /* dehacked.h */, + 1E44AE9E0B67CC8500BAD059 /* doomdata.h */, + 1E44AE9F0B67CC8500BAD059 /* doomdef.h */, + 1E44AEA00B67CC8500BAD059 /* doomstat.h */, + 1E44AEA10B67CC8500BAD059 /* doomtype.h */, + 1E44AFAF0B67CF7A00BAD059 /* z_zone.c */, + 1E44AFB00B67CF7A00BAD059 /* z_zone.h */, + ); + name = D_Doom; + sourceTree = ""; + }; + 1E44AEBB0B67CC9800BAD059 /* F_Frame */ = { + isa = PBXGroup; + children = ( + 1E44AEBC0B67CCA900BAD059 /* f_wipe.c */, + 1E44AEBD0B67CCA900BAD059 /* f_finale.c */, + 1E44AEBE0B67CCA900BAD059 /* f_finale.h */, + 1E44AFAB0B67CF6F00BAD059 /* y_inter.c */, + 1E44AFAC0B67CF6F00BAD059 /* y_inter.h */, + ); + name = F_Frame; + sourceTree = ""; + }; + 1E44AEC20B67CCB500BAD059 /* G_Game */ = { + isa = PBXGroup; + children = ( + 1E44AEC30B67CCC600BAD059 /* g_game.c */, + 1E44AEC40B67CCC600BAD059 /* g_game.h */, + 1E44AEC50B67CCC600BAD059 /* g_input.h */, + 1E44AEC60B67CCC600BAD059 /* g_state.h */, + 1E44AEC70B67CCC600BAD059 /* g_input.c */, + ); + name = G_Game; + sourceTree = ""; + }; + 1E44AECD0B67CCD200BAD059 /* H_Hud */ = { + isa = PBXGroup; + children = ( + 1E44AEE10B67CD2B00BAD059 /* am_map.c */, + 1E44AEE20B67CD2B00BAD059 /* am_map.h */, + 1E44AEE70B67CD3F00BAD059 /* command.c */, + 1E44AEE80B67CD3F00BAD059 /* command.h */, + 1E44AEED0B67CD5400BAD059 /* console.c */, + 1E44AEEE0B67CD5400BAD059 /* console.h */, + 1E44AECE0B67CCEE00BAD059 /* hu_stuff.c */, + 1E44AECF0B67CCEE00BAD059 /* hu_stuff.h */, + 1E44AF000B67CDE900BAD059 /* m_menu.c */, + 1E44AF010B67CDE900BAD059 /* m_menu.h */, + 1E44AF910B67CEFF00BAD059 /* st_stuff.c */, + 1E44AF920B67CEFF00BAD059 /* st_stuff.h */, + ); + name = H_Hud; + sourceTree = ""; + }; + 1E44AED20B67CCF600BAD059 /* I_Interface */ = { + isa = PBXGroup; + children = ( + 67259E0218D268F600F02971 /* i_ttf.c */, + 67259E0318D268F600F02971 /* i_ttf.h */, + 67259E0418D268F600F02971 /* mixer_sound.c */, + 67259E0518D268F600F02971 /* sdl_sound.c */, + 1E44AFB30B67CF8500BAD059 /* SDL */, + 67B83C2D14F57F1500AAAE4E /* i_addrinfo.c */, + 67B83C2E14F57F1500AAAE4E /* i_addrinfo.h */, + 1E44AEE50B67CD3200BAD059 /* byteptr.h */, + 1E44AEF10B67CD7F00BAD059 /* filesrch.c */, + 1E44AEF20B67CD7F00BAD059 /* filesrch.h */, + 1E44AED30B67CD1200BAD059 /* i_net.h */, + 1E44AED40B67CD1200BAD059 /* i_sound.h */, + 1E44AED50B67CD1200BAD059 /* i_tcp.c */, + 1E44AED60B67CD1200BAD059 /* i_tcp.h */, + 1E44AED70B67CD1200BAD059 /* i_system.h */, + 1E44AED80B67CD1200BAD059 /* i_video.h */, + 1E44AED90B67CD1300BAD059 /* i_joy.h */, + 1E44AEF50B67CD9F00BAD059 /* keys.h */, + 1E44AF200B67CE4100BAD059 /* mserv.c */, + 1E44AF210B67CE4100BAD059 /* mserv.h */, + ); + name = I_Interface; + sourceTree = ""; + }; + 1E44AEF70B67CDA900BAD059 /* M_Misc */ = { + isa = PBXGroup; + children = ( + 67259DFF18D268AE00F02971 /* m_anigif.c */, + 67259E0018D268AE00F02971 /* m_anigif.h */, + 1E44AEF80B67CDE900BAD059 /* m_argv.c */, + 1E44AEFA0B67CDE900BAD059 /* m_argv.h */, + 1E44AEFC0B67CDE900BAD059 /* m_bbox.c */, + 1E44AEF90B67CDE900BAD059 /* m_bbox.h */, + 1E44AEFB0B67CDE900BAD059 /* m_cheat.c */, + 1E44AEFD0B67CDE900BAD059 /* m_cheat.h */, + 67B83C2F14F57F1500AAAE4E /* m_cond.c */, + 67B83C3014F57F1500AAAE4E /* m_cond.h */, + 67B83C3114F57F1500AAAE4E /* m_dllist.h */, + 1E44AEFE0B67CDE900BAD059 /* m_fixed.c */, + 1E44AEFF0B67CDE900BAD059 /* m_fixed.h */, + 1E44AF020B67CDE900BAD059 /* m_misc.c */, + 1E44AF030B67CDE900BAD059 /* m_misc.h */, + 676BB51C0E0DE06100C95963 /* m_queue.c */, + 676BB51D0E0DE06100C95963 /* m_queue.h */, + 1E44AF040B67CDE900BAD059 /* m_random.c */, + 1E44AF050B67CDE900BAD059 /* m_random.h */, + 1E44AF060B67CDE900BAD059 /* m_swap.h */, + 1E44AF950B67CF1300BAD059 /* string.c */, + ); + name = M_Misc; + sourceTree = ""; + }; + 1E44AF160B67CDFB00BAD059 /* P_Play */ = { + isa = PBXGroup; + children = ( + 1E44AF180B67CE2A00BAD059 /* info.c */, + 1E44AF190B67CE2A00BAD059 /* info.h */, + 1E44AF3B0B67CE5F00BAD059 /* p_ceilng.c */, + 1E44AF240B67CE5F00BAD059 /* p_enemy.c */, + 1E44AF250B67CE5F00BAD059 /* p_inter.c */, + 1E44AF260B67CE5F00BAD059 /* p_fab.c */, + 1E44AF270B67CE5F00BAD059 /* p_lights.c */, + 1E44AF280B67CE5F00BAD059 /* p_map.c */, + 1E44AF290B67CE5F00BAD059 /* p_maputl.c */, + 1E44AF2A0B67CE5F00BAD059 /* p_maputl.h */, + 1E44AF2B0B67CE5F00BAD059 /* p_mobj.c */, + 1E44AF2C0B67CE5F00BAD059 /* p_mobj.h */, + 1E44AF2D0B67CE5F00BAD059 /* p_floor.c */, + 1E44AF2E0B67CE5F00BAD059 /* p_local.h */, + 676BB51E0E0DE06100C95963 /* p_polyobj.c */, + 676BB51F0E0DE06100C95963 /* p_polyobj.h */, + 1E44AF2F0B67CE5F00BAD059 /* p_pspr.h */, + 1E44AF300B67CE5F00BAD059 /* p_saveg.c */, + 1E44AF310B67CE5F00BAD059 /* p_saveg.h */, + 1E44AF320B67CE5F00BAD059 /* p_setup.c */, + 1E44AF330B67CE5F00BAD059 /* p_setup.h */, + 1E44AF340B67CE5F00BAD059 /* p_sight.c */, + 1E44AF350B67CE5F00BAD059 /* p_spec.c */, + 1E44AF360B67CE5F00BAD059 /* p_spec.h */, + 1E44AF370B67CE5F00BAD059 /* p_telept.c */, + 1E44AF380B67CE5F00BAD059 /* p_tick.c */, + 1E44AF390B67CE5F00BAD059 /* p_tick.h */, + 1E44AF3A0B67CE5F00BAD059 /* p_user.c */, + 1E44AF990B67CF2E00BAD059 /* tables.c */, + 1E44AF9A0B67CF2E00BAD059 /* tables.h */, + ); + name = P_Play; + sourceTree = ""; + }; + 1E44AF170B67CE1000BAD059 /* W_Wad */ = { + isa = PBXGroup; + children = ( + 1E44B2240B67EADE00BAD059 /* lzf.c */, + 1E44B2250B67EADE00BAD059 /* lzf.h */, + 1E44AF1C0B67CE3600BAD059 /* md5.c */, + 1E44AF1D0B67CE3600BAD059 /* md5.h */, + 1E44AFA70B67CF6400BAD059 /* w_wad.c */, + 1E44AFA80B67CF6400BAD059 /* w_wad.h */, + ); + name = W_Wad; + sourceTree = ""; + }; + 1E44AF540B67CE8C00BAD059 /* R_Render */ = { + isa = PBXGroup; + children = ( + 1E44AF550B67CEC100BAD059 /* r_bsp.c */, + 1E44AF560B67CEC100BAD059 /* r_bsp.h */, + 1E44AF570B67CEC100BAD059 /* r_defs.h */, + 1E44AF580B67CEC100BAD059 /* r_data.c */, + 1E44AF590B67CEC100BAD059 /* r_draw.c */, + 1E44AF5A0B67CEC100BAD059 /* r_draw16.c */, + 1E44AF5B0B67CEC100BAD059 /* r_draw8.c */, + 1E44AF5C0B67CEC100BAD059 /* r_main.c */, + 1E44AF5D0B67CEC100BAD059 /* r_main.h */, + 1E44AF5E0B67CEC100BAD059 /* r_data.h */, + 1E44AF5F0B67CEC100BAD059 /* r_draw.h */, + 1E44AF600B67CEC100BAD059 /* r_local.h */, + 1E44AF610B67CEC100BAD059 /* r_plane.c */, + 1E44AF620B67CEC100BAD059 /* r_plane.h */, + 1E44AF630B67CEC100BAD059 /* r_segs.c */, + 1E44AF640B67CEC100BAD059 /* r_segs.h */, + 1E44AF650B67CEC200BAD059 /* r_sky.c */, + 1E44AF660B67CEC200BAD059 /* r_sky.h */, + 1E44AF670B67CEC200BAD059 /* r_splats.c */, + 1E44AF680B67CEC200BAD059 /* r_splats.h */, + 1E44AF690B67CEC200BAD059 /* r_state.h */, + 1E44AF6A0B67CEC200BAD059 /* r_things.c */, + 1E44AF6B0B67CEC200BAD059 /* r_things.h */, + 1E44AF890B67CEE900BAD059 /* screen.c */, + 1E44AF8A0B67CEE900BAD059 /* screen.h */, + 1E44AFA30B67CF5D00BAD059 /* v_video.c */, + 1E44AFA40B67CF5D00BAD059 /* v_video.h */, + ); + name = R_Render; + sourceTree = ""; + }; + 1E44AF830B67CEC900BAD059 /* S_Sound */ = { + isa = PBXGroup; + children = ( + 1E44AF850B67CEE000BAD059 /* s_sound.c */, + 1E44AF860B67CEE000BAD059 /* s_sound.h */, + 1E44AF8D0B67CEF000BAD059 /* sounds.c */, + 1E44AF8E0B67CEF000BAD059 /* sounds.h */, + ); + name = S_Sound; + sourceTree = ""; + }; + 1E44AFB30B67CF8500BAD059 /* SDL */ = { + isa = PBXGroup; + children = ( + 1E44AFE50B67D04900BAD059 /* macosx */, + 1E44AFD40B67D03100BAD059 /* filter */, + 1E44AFB40B67CFDC00BAD059 /* dosstr.c */, + 1E44AFB50B67CFDC00BAD059 /* endtxt.c */, + 1E44AFB60B67CFDC00BAD059 /* endtxt.h */, + 1E44AFB70B67CFDC00BAD059 /* hwsym_sdl.c */, + 1E44AFB80B67CFDC00BAD059 /* hwsym_sdl.h */, + 1E44AFB90B67CFDC00BAD059 /* i_cdmus.c */, + 1E44AFBA0B67CFDC00BAD059 /* i_main.c */, + 1E44AFBB0B67CFDC00BAD059 /* i_net.c */, + 1E44AFBD0B67CFDC00BAD059 /* i_system.c */, + 1E44AFBE0B67CFDC00BAD059 /* i_video.c */, + 1E44AFBF0B67CFDC00BAD059 /* IMG_xpm.c */, + 1E44AFEC0B67D0AB00BAD059 /* r_opengl.c */, + 1E44AFC00B67CFDC00BAD059 /* ogl_sdl.c */, + 1E44AFC10B67CFDC00BAD059 /* ogl_sdl.h */, + 1E44AFC20B67CFDC00BAD059 /* SDL_icon.xpm */, + 1E44AFC30B67CFDC00BAD059 /* sdlmain.h */, + ); + name = SDL; + sourceTree = ""; + }; + 1E44AFD40B67D03100BAD059 /* filter */ = { + isa = PBXGroup; + children = ( + 1E44AFD50B67D03100BAD059 /* filters.c */, + 1E44AFD60B67D03100BAD059 /* filters.h */, + 1E44AFD70B67D03100BAD059 /* hq2x.c */, + 1E44AFD80B67D03100BAD059 /* hq2x.h */, + 1E44AFD90B67D03100BAD059 /* interp.h */, + 1E44AFDA0B67D03100BAD059 /* lq2x.c */, + 1E44AFDB0B67D03100BAD059 /* lq2x.h */, + 1E44AFDC0B67D03100BAD059 /* main.c */, + ); + name = filter; + path = ../filter; + sourceTree = SOURCE_ROOT; + }; + 1E44AFE50B67D04900BAD059 /* macosx */ = { + isa = PBXGroup; + children = ( + 1E44AFE60B67D06200BAD059 /* mac_alert.h */, + 1E44AFE70B67D06200BAD059 /* Srb2mac.icns */, + 1E44AFE80B67D06200BAD059 /* mac_alert.c */, + 1E44B0560B67D81E00BAD059 /* SDL_macosx_main.h */, + 1E44B0570B67D81E00BAD059 /* SDL_macosx_main.m */, + ); + name = macosx; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* Srb2mac */ = { + isa = PBXGroup; + children = ( + 080E96DDFE201D6D7F000001 /* Classes */, + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = Srb2mac; + sourceTree = ""; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + ); + name = "Other Sources"; + sourceTree = ""; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 67259E2B18D26D5700F02971 /* patch.dta */, + 67259E2C18D26D5700F02971 /* rings.dta */, + 67259E2D18D26D5700F02971 /* srb2.srb */, + 67A1F91813FAD026009FA3E5 /* player.dta */, + 6766C0AE11B057E50065F389 /* zones.dta */, + 1E44AE440B67CBE800BAD059 /* music.dta */, + 1E44AE4B0B67CBE800BAD059 /* srb2.wad */, + 8D1107310486CEB800E47090 /* Info.plist */, + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, + ); + name = Resources; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = ""; + }; + 67B83BC814F57D6E00AAAE4E /* LUA */ = { + isa = PBXGroup; + children = ( + 67259DFA18D2687D00F02971 /* lua_hud.h */, + 67259DFB18D2687D00F02971 /* lua_hudlib.c */, + 67259DFC18D2687D00F02971 /* lua_skinlib.c */, + 67B83C2C14F57F1500AAAE4E /* fastcmp.h */, + 67B83C1514F57EE600AAAE4E /* lua_baselib.c */, + 67B83C1614F57EE600AAAE4E /* lua_consolelib.c */, + 67B83C1714F57EE600AAAE4E /* lua_hook.h */, + 67B83C1814F57EE600AAAE4E /* lua_hooklib.c */, + 67B83C1914F57EE600AAAE4E /* lua_infolib.c */, + 67B83C1A14F57EE600AAAE4E /* lua_libs.h */, + 67B83C1B14F57EE600AAAE4E /* lua_maplib.c */, + 67B83C1C14F57EE600AAAE4E /* lua_mathlib.c */, + 67B83C1D14F57EE600AAAE4E /* lua_mobjlib.c */, + 67B83C1E14F57EE600AAAE4E /* lua_playerlib.c */, + 67B83C1F14F57EE600AAAE4E /* lua_script.c */, + 67B83C2014F57EE600AAAE4E /* lua_script.h */, + 67B83C2114F57EE600AAAE4E /* lua_thinkerlib.c */, + ); + name = LUA; + sourceTree = ""; + }; + 67B83BC914F57D7F00AAAE4E /* BLUA */ = { + isa = PBXGroup; + children = ( + 67B83BCB14F57EAB00AAAE4E /* lapi.c */, + 67B83BCC14F57EAB00AAAE4E /* lapi.h */, + 67B83BCD14F57EAB00AAAE4E /* lauxlib.c */, + 67B83BCE14F57EAB00AAAE4E /* lauxlib.h */, + 67B83BCF14F57EAB00AAAE4E /* lbaselib.c */, + 67B83BD014F57EAB00AAAE4E /* lcode.c */, + 67B83BD114F57EAB00AAAE4E /* lcode.h */, + 67B83BD214F57EAB00AAAE4E /* ldebug.c */, + 67B83BD314F57EAB00AAAE4E /* ldebug.h */, + 67B83BD414F57EAB00AAAE4E /* ldo.c */, + 67B83BD514F57EAB00AAAE4E /* ldo.h */, + 67B83BD614F57EAB00AAAE4E /* ldump.c */, + 67B83BD714F57EAB00AAAE4E /* lfunc.c */, + 67B83BD814F57EAB00AAAE4E /* lfunc.h */, + 67B83BD914F57EAB00AAAE4E /* lgc.c */, + 67B83BDA14F57EAB00AAAE4E /* lgc.h */, + 67B83BDB14F57EAB00AAAE4E /* linit.c */, + 67B83BDC14F57EAB00AAAE4E /* llex.c */, + 67B83BDD14F57EAB00AAAE4E /* llex.h */, + 67B83BDE14F57EAB00AAAE4E /* llimits.h */, + 67B83BDF14F57EAB00AAAE4E /* lmem.c */, + 67B83BE014F57EAB00AAAE4E /* lmem.h */, + 67B83BE114F57EAB00AAAE4E /* lobject.c */, + 67B83BE214F57EAB00AAAE4E /* lobject.h */, + 67B83BE314F57EAB00AAAE4E /* lopcodes.c */, + 67B83BE414F57EAB00AAAE4E /* lopcodes.h */, + 67B83BE514F57EAB00AAAE4E /* lparser.c */, + 67B83BE614F57EAB00AAAE4E /* lparser.h */, + 67B83BE714F57EAB00AAAE4E /* lstate.c */, + 67B83BE814F57EAB00AAAE4E /* lstate.h */, + 67B83BE914F57EAB00AAAE4E /* lstring.c */, + 67B83BEA14F57EAB00AAAE4E /* lstring.h */, + 67B83BEB14F57EAB00AAAE4E /* lstrlib.c */, + 67B83BEC14F57EAB00AAAE4E /* ltable.c */, + 67B83BED14F57EAB00AAAE4E /* ltable.h */, + 67B83BEE14F57EAB00AAAE4E /* ltablib.c */, + 67B83BEF14F57EAB00AAAE4E /* ltm.c */, + 67B83BF014F57EAB00AAAE4E /* ltm.h */, + 67B83BF114F57EAB00AAAE4E /* lua.h */, + 67B83BF214F57EAB00AAAE4E /* luaconf.h */, + 67B83BF314F57EAB00AAAE4E /* lualib.h */, + 67B83BF414F57EAB00AAAE4E /* lundump.c */, + 67B83BF514F57EAB00AAAE4E /* lundump.h */, + 67B83BF614F57EAB00AAAE4E /* lvm.c */, + 67B83BF714F57EAB00AAAE4E /* lvm.h */, + 67B83BF814F57EAB00AAAE4E /* lzio.c */, + 67B83BF914F57EAB00AAAE4E /* lzio.h */, + ); + name = BLUA; + sourceTree = ""; + }; + 67B83BCA14F57DD400AAAE4E /* B_Bot */ = { + isa = PBXGroup; + children = ( + 67B83C1214F57ECA00AAAE4E /* b_bot.c */, + 67B83C1314F57ECA00AAAE4E /* b_bot.h */, + ); + name = B_Bot; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8D1107260486CEB800E47090 /* Srb2mac */ = { + isa = PBXNativeTarget; + buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Srb2mac" */; + buildPhases = ( + 8D1107290486CEB800E47090 /* Resources */, + 677E4CB30E1765500034519D /* Get SCM Info */, + 8D11072C0486CEB800E47090 /* Sources */, + 8D11072E0486CEB800E47090 /* Frameworks */, + 002F39FD09D0883400EBEB88 /* Copy Frameworks into .app bundle */, + 679B708A102B872300AA9E4C /* Make DMG */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Srb2mac; + productInstallPath = "$(HOME)/Applications"; + productName = Srb2mac; + productReference = 8D1107320486CEB800E47090 /* Srb2mac.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Srb2mac" */; + compatibilityVersion = "Xcode 2.4"; + hasScannedForEncodings = 1; + mainGroup = 29B97314FDCFA39411CA2CEA /* Srb2mac */; + projectDirPath = ""; + projectRoot = ../../..; + targets = ( + 8D1107260486CEB800E47090 /* Srb2mac */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8D1107290486CEB800E47090 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, + 1E44AFEA0B67D06200BAD059 /* Srb2mac.icns in Resources */, + 67259E2E18D26D5700F02971 /* patch.dta in Resources */, + 67259E2F18D26D5700F02971 /* rings.dta in Resources */, + 67259E3018D26D5700F02971 /* srb2.srb in Resources */, + 67259E3218D26DD200F02971 /* music.dta in Resources */, + 67259E3318D26DD300F02971 /* player.dta in Resources */, + 67259E3518D26DD500F02971 /* zones.dta in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 677E4CB30E1765500034519D /* Get SCM Info */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + comments = "update the time and date stamps in src/comptime.c"; + files = ( + ); + inputPaths = ( + ); + name = "Get SCM Info"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "PATH=\"/usr/local/bin:$PATH\" $SRCROOT/../../../comptime.sh $SRCROOT/../../"; + }; + 679B708A102B872300AA9E4C /* Make DMG */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + comments = "make DMG file for Release builds"; + files = ( + ); + inputPaths = ( + $BUILT_PRODUCTS_DIR/$WRAPPER_NAME, + ); + name = "Make DMG"; + outputPaths = ( + $BUILT_PRODUCTS_DIR/$TARGET_NAME.nodata.dmg, + $BUILT_PRODUCTS_DIR/$TARGET_NAME.dmg, + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "set -ex\n\n[ \"$ACTION\" = build ] || exit 0\n[ \"$CURRENT_VARIANT\" = \"normal\" ] || exit 0\n[ \"$BUILD_STYLE\" = \"Release\" ] || exit 0\n\ndir=\"$TEMP_FILES_DIR/$TARGET_NAME.disk\"\ndmg=\"$BUILT_PRODUCTS_DIR/$TARGET_NAME.dmg\"\ndmg_nodata=\"$BUILT_PRODUCTS_DIR/$TARGET_NAME.nodata.dmg\"\n\nrm -rf -- \"$dir\"\nmkdir \"$dir\"\ncp -R \"$BUILT_PRODUCTS_DIR/$WRAPPER_NAME\" \"$dir\"\nrm -f -- \"$dmg\"\nhdiutil create -ov -fs HFS+ -srcfolder \"$dir\" -volname \"$TARGET_NAME\" \"$dmg\"\nhdiutil internet-enable -yes \"$dmg\"\ncd \"$dir/$WRAPPER_NAME/Contents/Resources\"\nrm -f -- *.wad\nrm -f -- *.dta\nrm -f -- *.plr\nrm -f -- *.wpn\nrm -f -- *.srb2\ncd \"$OLDPWD\"\nrm -f -- \"$dmg_nodata\"\nhdiutil create -ov -fs HFS+ -srcfolder \"$dir\" -volname \"$TARGET_NAME Lite\" \"$dmg_nodata\"\nhdiutil internet-enable -yes \"$dmg_nodata\"\nrm -rf -- \"$dir\""; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8D11072C0486CEB800E47090 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1E44AE750B67CC2B00BAD059 /* hw_bsp.c in Sources */, + 1E44AE770B67CC2B00BAD059 /* hw3sound.c in Sources */, + 1E44AE780B67CC2B00BAD059 /* hw_cache.c in Sources */, + 1E44AE7C0B67CC2B00BAD059 /* hw_light.c in Sources */, + 1E44AE800B67CC2B00BAD059 /* hw_draw.c in Sources */, + 1E44AE820B67CC2B00BAD059 /* hw_main.c in Sources */, + 1E44AE840B67CC2B00BAD059 /* hw_md2.c in Sources */, + 1E44AE860B67CC2B00BAD059 /* hw_trick.c in Sources */, + 1E44AEA40B67CC8500BAD059 /* d_clisrv.c in Sources */, + 1E44AEA70B67CC8500BAD059 /* d_main.c in Sources */, + 1E44AEA80B67CC8500BAD059 /* d_net.c in Sources */, + 1E44AEAB0B67CC8500BAD059 /* d_netfil.c in Sources */, + 1E44AEAF0B67CC8500BAD059 /* d_netcmd.c in Sources */, + 1E44AEB30B67CC8500BAD059 /* dehacked.c in Sources */, + 1E44AEBF0B67CCA900BAD059 /* f_wipe.c in Sources */, + 1E44AEC00B67CCA900BAD059 /* f_finale.c in Sources */, + 1E44AEC80B67CCC600BAD059 /* g_game.c in Sources */, + 1E44AECC0B67CCC600BAD059 /* g_input.c in Sources */, + 1E44AED00B67CCEE00BAD059 /* hu_stuff.c in Sources */, + 1E44AEDC0B67CD1300BAD059 /* i_tcp.c in Sources */, + 1E44AEE30B67CD2B00BAD059 /* am_map.c in Sources */, + 1E44AEE90B67CD3F00BAD059 /* command.c in Sources */, + 1E44AEEC0B67CD4400BAD059 /* comptime.c in Sources */, + 1E44AEEF0B67CD5400BAD059 /* console.c in Sources */, + 1E44AEF30B67CD7F00BAD059 /* filesrch.c in Sources */, + 1E44AF070B67CDE900BAD059 /* m_argv.c in Sources */, + 1E44AF0A0B67CDE900BAD059 /* m_cheat.c in Sources */, + 1E44AF0B0B67CDE900BAD059 /* m_bbox.c in Sources */, + 1E44AF0D0B67CDE900BAD059 /* m_fixed.c in Sources */, + 1E44AF0F0B67CDE900BAD059 /* m_menu.c in Sources */, + 1E44AF110B67CDE900BAD059 /* m_misc.c in Sources */, + 1E44AF130B67CDE900BAD059 /* m_random.c in Sources */, + 1E44AF1A0B67CE2A00BAD059 /* info.c in Sources */, + 1E44AF1E0B67CE3600BAD059 /* md5.c in Sources */, + 1E44AF220B67CE4100BAD059 /* mserv.c in Sources */, + 1E44AF3C0B67CE5F00BAD059 /* p_enemy.c in Sources */, + 1E44AF3D0B67CE5F00BAD059 /* p_inter.c in Sources */, + 1E44AF3E0B67CE5F00BAD059 /* p_fab.c in Sources */, + 1E44AF3F0B67CE5F00BAD059 /* p_lights.c in Sources */, + 1E44AF400B67CE5F00BAD059 /* p_map.c in Sources */, + 1E44AF410B67CE5F00BAD059 /* p_maputl.c in Sources */, + 1E44AF430B67CE5F00BAD059 /* p_mobj.c in Sources */, + 1E44AF450B67CE5F00BAD059 /* p_floor.c in Sources */, + 1E44AF480B67CE5F00BAD059 /* p_saveg.c in Sources */, + 1E44AF4A0B67CE5F00BAD059 /* p_setup.c in Sources */, + 1E44AF4C0B67CE5F00BAD059 /* p_sight.c in Sources */, + 1E44AF4D0B67CE5F00BAD059 /* p_spec.c in Sources */, + 1E44AF4F0B67CE5F00BAD059 /* p_telept.c in Sources */, + 1E44AF500B67CE5F00BAD059 /* p_tick.c in Sources */, + 1E44AF520B67CE5F00BAD059 /* p_user.c in Sources */, + 1E44AF530B67CE5F00BAD059 /* p_ceilng.c in Sources */, + 1E44AF6C0B67CEC200BAD059 /* r_bsp.c in Sources */, + 1E44AF6F0B67CEC200BAD059 /* r_data.c in Sources */, + 1E44AF700B67CEC200BAD059 /* r_draw.c in Sources */, + 1E44AF730B67CEC200BAD059 /* r_main.c in Sources */, + 1E44AF780B67CEC200BAD059 /* r_plane.c in Sources */, + 1E44AF7A0B67CEC200BAD059 /* r_segs.c in Sources */, + 1E44AF7C0B67CEC200BAD059 /* r_sky.c in Sources */, + 1E44AF7E0B67CEC200BAD059 /* r_splats.c in Sources */, + 1E44AF810B67CEC200BAD059 /* r_things.c in Sources */, + 1E44AF870B67CEE000BAD059 /* s_sound.c in Sources */, + 1E44AF8B0B67CEE900BAD059 /* screen.c in Sources */, + 1E44AF8F0B67CEF000BAD059 /* sounds.c in Sources */, + 1E44AF930B67CEFF00BAD059 /* st_stuff.c in Sources */, + 1E44AF9B0B67CF2E00BAD059 /* tables.c in Sources */, + 1E44AFA50B67CF5D00BAD059 /* v_video.c in Sources */, + 1E44AFA90B67CF6400BAD059 /* w_wad.c in Sources */, + 1E44AFAD0B67CF6F00BAD059 /* y_inter.c in Sources */, + 1E44AFB10B67CF7A00BAD059 /* z_zone.c in Sources */, + 1E44AFC40B67CFDC00BAD059 /* dosstr.c in Sources */, + 1E44AFC50B67CFDC00BAD059 /* endtxt.c in Sources */, + 1E44AFC70B67CFDC00BAD059 /* hwsym_sdl.c in Sources */, + 1E44AFC90B67CFDC00BAD059 /* i_cdmus.c in Sources */, + 1E44AFCA0B67CFDC00BAD059 /* i_main.c in Sources */, + 1E44AFCB0B67CFDC00BAD059 /* i_net.c in Sources */, + 1E44AFCD0B67CFDC00BAD059 /* i_system.c in Sources */, + 1E44AFCE0B67CFDC00BAD059 /* i_video.c in Sources */, + 1E44AFD00B67CFDC00BAD059 /* ogl_sdl.c in Sources */, + 1E44AFEB0B67D06200BAD059 /* mac_alert.c in Sources */, + 1E44AFED0B67D0AB00BAD059 /* r_opengl.c in Sources */, + 1E44B0590B67D81E00BAD059 /* SDL_macosx_main.m in Sources */, + 1E308E720B71172D0015728C /* lzf.c in Sources */, + 676BB5200E0DE06100C95963 /* m_queue.c in Sources */, + 676BB5220E0DE06100C95963 /* p_polyobj.c in Sources */, + 67B83BFA14F57EAB00AAAE4E /* lapi.c in Sources */, + 67B83BFB14F57EAB00AAAE4E /* lauxlib.c in Sources */, + 67B83BFC14F57EAB00AAAE4E /* lbaselib.c in Sources */, + 67B83BFD14F57EAB00AAAE4E /* lcode.c in Sources */, + 67B83BFE14F57EAB00AAAE4E /* ldebug.c in Sources */, + 67B83BFF14F57EAB00AAAE4E /* ldo.c in Sources */, + 67B83C0014F57EAB00AAAE4E /* ldump.c in Sources */, + 67B83C0114F57EAB00AAAE4E /* lfunc.c in Sources */, + 67B83C0214F57EAB00AAAE4E /* lgc.c in Sources */, + 67B83C0314F57EAB00AAAE4E /* linit.c in Sources */, + 67B83C0414F57EAB00AAAE4E /* llex.c in Sources */, + 67B83C0514F57EAB00AAAE4E /* lmem.c in Sources */, + 67B83C0614F57EAB00AAAE4E /* lobject.c in Sources */, + 67B83C0714F57EAB00AAAE4E /* lopcodes.c in Sources */, + 67B83C0814F57EAB00AAAE4E /* lparser.c in Sources */, + 67B83C0914F57EAB00AAAE4E /* lstate.c in Sources */, + 67B83C0A14F57EAB00AAAE4E /* lstring.c in Sources */, + 67B83C0B14F57EAB00AAAE4E /* lstrlib.c in Sources */, + 67B83C0C14F57EAB00AAAE4E /* ltable.c in Sources */, + 67B83C0D14F57EAB00AAAE4E /* ltablib.c in Sources */, + 67B83C0E14F57EAB00AAAE4E /* ltm.c in Sources */, + 67B83C0F14F57EAB00AAAE4E /* lundump.c in Sources */, + 67B83C1014F57EAB00AAAE4E /* lvm.c in Sources */, + 67B83C1114F57EAB00AAAE4E /* lzio.c in Sources */, + 67B83C1414F57ECA00AAAE4E /* b_bot.c in Sources */, + 67B83C2214F57EE600AAAE4E /* lua_baselib.c in Sources */, + 67B83C2314F57EE600AAAE4E /* lua_consolelib.c in Sources */, + 67B83C2414F57EE600AAAE4E /* lua_hooklib.c in Sources */, + 67B83C2514F57EE600AAAE4E /* lua_infolib.c in Sources */, + 67B83C2614F57EE600AAAE4E /* lua_maplib.c in Sources */, + 67B83C2714F57EE600AAAE4E /* lua_mathlib.c in Sources */, + 67B83C2814F57EE600AAAE4E /* lua_mobjlib.c in Sources */, + 67B83C2914F57EE600AAAE4E /* lua_playerlib.c in Sources */, + 67B83C2A14F57EE600AAAE4E /* lua_script.c in Sources */, + 67B83C2B14F57EE600AAAE4E /* lua_thinkerlib.c in Sources */, + 67B83C3314F57F1500AAAE4E /* m_cond.c in Sources */, + 67259DFD18D2687D00F02971 /* lua_hudlib.c in Sources */, + 67259DFE18D2687D00F02971 /* lua_skinlib.c in Sources */, + 67259E0118D268AE00F02971 /* m_anigif.c in Sources */, + 67259E0618D268F700F02971 /* i_ttf.c in Sources */, + 67259E0718D268F700F02971 /* mixer_sound.c in Sources */, + 67259E0818D268F700F02971 /* sdl_sound.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 089C165DFE840E0CC02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + C01FCF4B08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CURRENT_PROJECT_VERSION = 2.1.9; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + NORMALSRB2, + ); + PRODUCT_NAME = Srb2mac; + }; + name = Debug; + }; + C01FCF4C08A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CURRENT_PROJECT_VERSION = 2.1.9; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + NORMALSRB2, + ); + PRODUCT_NAME = Srb2mac; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + i386, + ppc, + ); + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 0.0.0; + DEBUG_INFORMATION_FORMAT = dwarf; + DSTROOT = "$(HOME)/Applications"; + FRAMEWORK_SEARCH_PATHS = ( + "$(HOME)/Library/Frameworks", + /Library/Frameworks, + "$(FRAMEWORK_SEARCH_PATHS)", + ); + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_ENABLE_OBJC_EXCEPTIONS = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_FAST_OBJC_DISPATCH = NO; + "GCC_MODEL_TUNING[arch=ppc]" = G3; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + MAC_ALERT, + SDLMAIN, + HAVE_SDL, + HAVE_MIXER, + HAVE_PNG, + HAVE_BLUA, + LUA_USE_POSIX, + COMPVERSION, + ); + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; + GCC_TREAT_NONCONFORMANT_CODE_ERRORS_AS_WARNINGS = YES; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION_i386 = 4.0; + GCC_VERSION_ppc0 = 3.3; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_GLOBAL_CONSTRUCTORS = YES; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = YES; + GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; + GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = YES; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; + GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES; + GCC_WARN_INHIBIT_ALL_WARNINGS = NO; + GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; + GCC_WARN_MISSING_PARENTHESES = YES; + GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO; + GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; + GCC_WARN_PEDANTIC = NO; + GCC_WARN_PROTOTYPE_CONVERSION = NO; + GCC_WARN_SHADOW = NO; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_STRICT_SELECTOR_MATCH = YES; + GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = NO; + GCC_WARN_UNKNOWN_PRAGMAS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_LABEL = YES; + GCC_WARN_UNUSED_PARAMETER = YES; + GCC_WARN_UNUSED_VALUE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + GGG_MODEL_TUNING_ppc = G3; + HEADER_SEARCH_PATHS = ( + "$(HOME)/Library/Frameworks/SDL.framework/Headers", + /Library/Frameworks/SDL.framework/Headers, + "$(HOME)/Library/Frameworks/SDL_mixer.framework/Headers", + /Library/Frameworks/SDL_mixer.framework/Headers, + "$(HOME)/Library/Frameworks/libz.framework/Headers", + /Library/Frameworks/libz.framework/Headers, + "$(HOME)/Library/Frameworks/libpng.framework/Headers", + /Library/Frameworks/libpng.framework/Headers, + "$(HEADER_SEARCH_PATHS)", + ); + INFOPLIST_FILE = Info.plist; + MACH_O_TYPE = mh_execute; + MACOSX_DEPLOYMENT_TARGET = 10.4; + "MACOSX_DEPLOYMENT_TARGET[arch=i386]" = 10.4; + "MACOSX_DEPLOYMENT_TARGET[arch=ppc64]" = 10.5; + "MACOSX_DEPLOYMENT_TARGET[arch=ppc]" = 10.2; + "MACOSX_DEPLOYMENT_TARGET[arch=x86_64]" = 10.5; + MACOSX_DEPLOYMENT_TARGET_i386 = 10.4; + MACOSX_DEPLOYMENT_TARGET_ppc = 10.2; + OBJROOT = "$(inherited)/$(PRODUCT_NAME)/$(CURRENT_PROJECT_VERSION)"; + OTHER_CFLAGS_normal = "-D_DEBUG -DPARANOIA -DRANGECHECK"; + PREBINDING = NO; + PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; + PRODUCT_NAME = SRB2dummy; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; + "SDKROOT[arch=i386]" = macosx10.4; + "SDKROOT[arch=ppc]" = macosx10.3.9; + SDKROOT_i386 = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; + SDKROOT_ppc = "$(DEVELOPER_SDK_DIR)/MacOSX10.3.9.sdk"; + STRIP_INSTALLED_PRODUCT = NO; + SYMROOT = "$(inherited)/$(PRODUCT_NAME)/$(CURRENT_PROJECT_VERSION)"; + WARNING_CFLAGS = ( + "-Wall", + "-W", + "-Wno-undef", + "-Wpointer-arith", + "-Wbad-function-cast", + "-Wno-cast-qual", + "-Wcast-align", + "-Wwrite-strings", + "-Waggregate-return", + "-Wmissing-prototypes", + "-Wmissing-declarations", + "-Wno-missing-noreturn", + "-Wnested-externs", + "-Winline", + ); + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + i386, + ppc, + ); + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 0.0.0; + DSTROOT = "$(HOME)/Applications"; + FRAMEWORK_SEARCH_PATHS = ( + "$(HOME)/Library/Frameworks", + /Library/Frameworks, + "$(FRAMEWORK_SEARCH_PATHS)", + ); + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_FAST_OBJC_DISPATCH = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + "GCC_MODEL_TUNING[arch=ppc]" = G3; + GCC_OPTIMIZATION_LEVEL = 2; + GCC_PREPROCESSOR_DEFINITIONS = ( + MAC_ALERT, + SDLMAIN, + HAVE_SDL, + HAVE_MIXER, + HAVE_PNG, + HAVE_BLUA, + LUA_USE_POSIX, + COMPVERSION, + ); + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; + GCC_TREAT_NONCONFORMANT_CODE_ERRORS_AS_WARNINGS = YES; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION_i386 = 4.0; + GCC_VERSION_ppc0 = 3.3; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_GLOBAL_CONSTRUCTORS = YES; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = YES; + GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; + GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = YES; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; + GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES; + GCC_WARN_INHIBIT_ALL_WARNINGS = NO; + GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; + GCC_WARN_MISSING_PARENTHESES = YES; + GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO; + GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; + GCC_WARN_PEDANTIC = NO; + GCC_WARN_PROTOTYPE_CONVERSION = NO; + GCC_WARN_SHADOW = NO; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_STRICT_SELECTOR_MATCH = YES; + GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNKNOWN_PRAGMAS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_LABEL = YES; + GCC_WARN_UNUSED_PARAMETER = YES; + GCC_WARN_UNUSED_VALUE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + GGG_MODEL_TUNING_ppc = G3; + HEADER_SEARCH_PATHS = ( + "$(HOME)/Library/Frameworks/SDL.framework/Headers", + /Library/Frameworks/SDL.framework/Headers, + "$(HOME)/Library/Frameworks/SDL_mixer.framework/Headers", + /Library/Frameworks/SDL_mixer.framework/Headers, + "$(HOME)/Library/Frameworks/libz.framework/Headers", + /Library/Frameworks/libz.framework/Headers, + "$(HOME)/Library/Frameworks/libpng.framework/Headers", + /Library/Frameworks/libpng.framework/Headers, + "$(HEADER_SEARCH_PATHS)", + ); + INFOPLIST_FILE = Info.plist; + MACH_O_TYPE = mh_execute; + MACOSX_DEPLOYMENT_TARGET = 10.4; + "MACOSX_DEPLOYMENT_TARGET[arch=i386]" = 10.4; + "MACOSX_DEPLOYMENT_TARGET[arch=ppc64]" = 10.5; + "MACOSX_DEPLOYMENT_TARGET[arch=ppc]" = 10.2; + "MACOSX_DEPLOYMENT_TARGET[arch=x86_64]" = 10.5; + MACOSX_DEPLOYMENT_TARGET_i386 = 10.4; + MACOSX_DEPLOYMENT_TARGET_ppc = 10.2; + OBJROOT = "$(inherited)/$(PRODUCT_NAME)/$(CURRENT_PROJECT_VERSION)"; + OTHER_CFLAGS_normal = "-DNDEBUG"; + PREBINDING = NO; + PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; + PRODUCT_NAME = SRB2dummy; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; + "SDKROOT[arch=i386]" = macosx10.4; + "SDKROOT[arch=ppc]" = macosx10.3.9; + SDKROOT_i386 = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; + SDKROOT_ppc = "$(DEVELOPER_SDK_DIR)/MacOSX10.3.9.sdk"; + STRIP_INSTALLED_PRODUCT = NO; + SYMROOT = "$(inherited)/$(PRODUCT_NAME)/$(CURRENT_PROJECT_VERSION)"; + WARNING_CFLAGS = ( + "-Wall", + "-W", + "-Wno-undef", + "-Wpointer-arith", + "-Wbad-function-cast", + "-Wno-cast-qual", + "-Wcast-align", + "-Wwrite-strings", + "-Waggregate-return", + "-Wmissing-prototypes", + "-Wmissing-declarations", + "-Wno-missing-noreturn", + "-Wnested-externs", + "-Winline", + "-Wno-aggregate-return", + ); + WRAPPER_EXTENSION = app; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Srb2mac" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4B08A954540054247B /* Debug */, + C01FCF4C08A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Srb2mac" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/src/sdl12/macosx/mac_alert.c b/src/sdl12/macosx/mac_alert.c new file mode 100644 index 000000000..455e36509 --- /dev/null +++ b/src/sdl12/macosx/mac_alert.c @@ -0,0 +1,45 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright (C) 1993-1996 by id Software, Inc. +// Portions 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 Graphical Alerts for MacOSX +/// +/// Shows alerts, since we can't just print these to the screen when +/// launched graphically on a mac. + +#ifdef __APPLE_CC__ + +#include "mac_alert.h" +#include + +int MacShowAlert(const char *title, const char *message, const char *button1, const char *button2, const char *button3) +{ + CFOptionFlags results; + + CFUserNotificationDisplayAlert(0, + kCFUserNotificationStopAlertLevel | kCFUserNotificationNoDefaultButtonFlag, + NULL, NULL, NULL, + CFStringCreateWithCString(NULL, title, kCFStringEncodingASCII), + CFStringCreateWithCString(NULL, message, kCFStringEncodingASCII), + button1 != NULL ? CFStringCreateWithCString(NULL, button1, kCFStringEncodingASCII) : NULL, + button2 != NULL ? CFStringCreateWithCString(NULL, button2, kCFStringEncodingASCII) : NULL, + button3 != NULL ? CFStringCreateWithCString(NULL, button3, kCFStringEncodingASCII) : NULL, + &results); + + return (int)results; +} + +#endif diff --git a/src/sdl12/macosx/mac_alert.h b/src/sdl12/macosx/mac_alert.h new file mode 100644 index 000000000..82a28d120 --- /dev/null +++ b/src/sdl12/macosx/mac_alert.h @@ -0,0 +1,27 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright (C) 1993-1996 by id Software, Inc. +// Portions 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 Graphical Alerts for MacOSX +/// +/// Shows alerts, since we can't just print these to the screen when +/// launched graphically on a mac. + +#ifdef __APPLE_CC__ + +extern int MacShowAlert(const char *title, const char *message, const char *button1, const char *button2, const char *button3); + +#endif diff --git a/src/sdl12/mixer_sound.c b/src/sdl12/mixer_sound.c new file mode 100644 index 000000000..151668752 --- /dev/null +++ b/src/sdl12/mixer_sound.c @@ -0,0 +1,824 @@ +/// \file +/// \brief SDL Mixer interface for sound + +#include "../doomdef.h" + +#if defined(HAVE_SDL) && defined(HAVE_MIXER) && SOUND==SOUND_MIXER + +#include "../sounds.h" +#include "../s_sound.h" +#include "../i_sound.h" +#include "../w_wad.h" +#include "../z_zone.h" +#include "../byteptr.h" + +#ifdef _MSC_VER +#pragma warning(disable : 4214 4244) +#endif +#include "SDL.h" +#ifdef _MSC_VER +#pragma warning(default : 4214 4244) +#endif + +#include "SDL_mixer.h" + +/* This is the version number macro for the current SDL_mixer version: */ +#ifndef SDL_MIXER_COMPILEDVERSION +#define SDL_MIXER_COMPILEDVERSION \ + SDL_VERSIONNUM(MIX_MAJOR_VERSION, MIX_MINOR_VERSION, MIX_PATCHLEVEL) +#endif + +/* This macro will evaluate to true if compiled with SDL_mixer at least X.Y.Z */ +#ifndef SDL_MIXER_VERSION_ATLEAST +#define SDL_MIXER_VERSION_ATLEAST(X, Y, Z) \ + (SDL_MIXER_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) +#endif + +#ifdef HAVE_LIBGME +#include "gme/gme.h" +#define GME_TREBLE 5.0 +#define GME_BASS 1.0 +#ifdef HAVE_PNG /// TODO: compile with zlib support without libpng + +#define HAVE_ZLIB + +#ifndef _MSC_VER +#ifndef _WII +#ifndef _LARGEFILE64_SOURCE +#define _LARGEFILE64_SOURCE +#endif +#endif +#endif + +#ifndef _LFS64_LARGEFILE +#define _LFS64_LARGEFILE +#endif + +#ifndef _FILE_OFFSET_BITS +#define _FILE_OFFSET_BITS 0 +#endif + +#include "zlib.h" +#endif +#endif + +UINT8 sound_started = false; + +static boolean midimode; +static Mix_Music *music; +static UINT8 music_volume, midi_volume, sfx_volume; +static float loop_point; + +#ifdef HAVE_LIBGME +static Music_Emu *gme; +static INT32 current_track; +#endif + +void I_StartupSound(void) +{ + I_Assert(!sound_started); + sound_started = true; + + midimode = false; + music = NULL; + music_volume = midi_volume = sfx_volume = 0; + +#if SDL_MIXER_VERSION_ATLEAST(1,2,11) + Mix_Init(MIX_INIT_FLAC|MIX_INIT_MOD|MIX_INIT_MP3|MIX_INIT_OGG); +#endif + Mix_OpenAudio(44100, AUDIO_S16LSB, 2, 2048); + Mix_AllocateChannels(256); +} + +void I_ShutdownSound(void) +{ + I_Assert(sound_started); + sound_started = false; + + Mix_CloseAudio(); +#if SDL_MIXER_VERSION_ATLEAST(1,2,11) + Mix_Quit(); +#endif +#ifdef HAVE_LIBGME + if (gme) + gme_delete(gme); +#endif +} + +void I_UpdateSound(void) +{ +} + +// this is as fast as I can possibly make it. +// sorry. more asm needed. +static Mix_Chunk *ds2chunk(void *stream) +{ + UINT16 ver,freq; + UINT32 samples, i, newsamples; + UINT8 *sound; + + SINT8 *s; + INT16 *d; + INT16 o; + fixed_t step, frac; + + // 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); + + // convert from signed 8bit ???hz to signed 16bit 44100hz. + switch(freq) + { + case 44100: + if (samples >= UINT32_MAX>>2) + return NULL; // would wrap, can't store. + newsamples = samples; + break; + case 22050: + if (samples >= UINT32_MAX>>3) + return NULL; // would wrap, can't store. + newsamples = samples<<1; + break; + case 11025: + if (samples >= UINT32_MAX>>4) + return NULL; // would wrap, can't store. + newsamples = samples<<2; + break; + default: + frac = (44100 << FRACBITS) / (UINT32)freq; + if (!(frac & 0xFFFF)) // other solid multiples (change if FRACBITS != 16) + newsamples = samples * (frac >> FRACBITS); + else // strange and unusual fractional frequency steps, plus anything higher than 44100hz. + newsamples = FixedMul(FixedDiv(samples, freq), 44100) + 1; // add 1 to counter truncation. + if (newsamples >= UINT32_MAX>>2) + return NULL; // would and/or did wrap, can't store. + break; + } + sound = Z_Malloc(newsamples<<2, PU_SOUND, NULL); // samples * frequency shift * bytes per sample * channels + + s = (SINT8 *)stream; + d = (INT16 *)sound; + + i = 0; + switch(freq) + { + case 44100: // already at the same rate? well that makes it simple. + while(i++ < samples) + { + o = ((INT16)(*s++)+0x80)<<8; // changed signedness and shift up to 16 bits + *d++ = o; // left channel + *d++ = o; // right channel + } + break; + case 22050: // unwrap 2x + while(i++ < samples) + { + o = ((INT16)(*s++)+0x80)<<8; // changed signedness and shift up to 16 bits + *d++ = o; // left channel + *d++ = o; // right channel + *d++ = o; // left channel + *d++ = o; // right channel + } + break; + case 11025: // unwrap 4x + while(i++ < samples) + { + o = ((INT16)(*s++)+0x80)<<8; // changed signedness and shift up to 16 bits + *d++ = o; // left channel + *d++ = o; // right channel + *d++ = o; // left channel + *d++ = o; // right channel + *d++ = o; // left channel + *d++ = o; // right channel + *d++ = o; // left channel + *d++ = o; // right channel + } + break; + default: // convert arbitrary hz to 44100. + step = 0; + frac = ((UINT32)freq << FRACBITS) / 44100; + while (i < samples) + { + o = (INT16)(*s+0x80)<<8; // changed signedness and shift up to 16 bits + while (step < FRACUNIT) // this is as fast as I can make it. + { + *d++ = o; // left channel + *d++ = o; // right channel + step += frac; + } + do { + i++; s++; + step -= FRACUNIT; + } while (step >= FRACUNIT); + } + break; + } + + // return Mixer Chunk. + return Mix_QuickLoad_RAW(sound, (UINT8*)d-sound); +} + +void *I_GetSfx(sfxinfo_t *sfx) +{ + void *lump; + Mix_Chunk *chunk; +#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); + + // convert from standard DoomSound format. + chunk = ds2chunk(lump); + if (chunk) + { + Z_Free(lump); + return chunk; + } + + // Not a doom sound? Try something else. +#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)) + { + short *mem; + UINT32 len; + gme_equalizer_t eq = {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(lump); // We're done with the uninflated lump now, too. + + gme_start_track(emu, 0); + gme_set_equalizer(emu, &eq); + gme_track_info(emu, &info, 0); + + len = (info->play_length * 441 / 10) << 2; + mem = Z_Malloc(len, PU_SOUND, NULL); + gme_play(emu, len >> 1, mem); + gme_delete(emu); + + return Mix_QuickLoad_RAW((Uint8 *)mem, len); + } + } + 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)) + { + short *mem; + UINT32 len; + gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0}; + + Z_Free(lump); + + gme_start_track(emu, 0); + gme_set_equalizer(emu, &eq); + gme_track_info(emu, &info, 0); + + len = (info->play_length * 441 / 10) << 2; + mem = Z_Malloc(len, PU_SOUND, NULL); + gme_play(emu, len >> 1, mem); + gme_delete(emu); + + return Mix_QuickLoad_RAW((Uint8 *)mem, len); + } +#endif + + // Try to load it as a WAVE or OGG using Mixer. + return Mix_LoadWAV_RW(SDL_RWFromMem(lump, sfx->length), 1); +} + +void I_FreeSfx(sfxinfo_t *sfx) +{ + if (sfx->data) + Mix_FreeChunk(sfx->data); + sfx->data = NULL; +} + +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +{ + UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127 + INT32 handle = Mix_PlayChannel(-1, S_sfx[id].data, 0); + Mix_Volume(handle, volume); + Mix_SetPanning(handle, min((UINT16)sep<<1, 0xff), min((UINT16)(0xff-sep)<<1, 0xff)); + (void)pitch; // Mixer can't handle pitch + (void)priority; // priority and channel management is handled by SRB2... + return handle; +} + +void I_StopSound(INT32 handle) +{ + Mix_HaltChannel(handle); +} + +boolean I_SoundIsPlaying(INT32 handle) +{ + return Mix_Playing(handle); +} + +void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep, UINT8 pitch) +{ + UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127 + Mix_Volume(handle, volume); + Mix_SetPanning(handle, min((UINT16)sep<<1, 0xff), min((UINT16)(0xff-sep)<<1, 0xff)); + (void)pitch; +} + +void I_SetSfxVolume(UINT8 volume) +{ + sfx_volume = volume; +} + +// +// Music +// + +// Music hooks +static void music_loop(void) +{ + Mix_PlayMusic(music, 0); + Mix_SetMusicPosition(loop_point); +} + +#ifdef HAVE_LIBGME +static void mix_gme(void *udata, Uint8 *stream, int len) +{ + int i; + short *p; + + (void)udata; + + // no gme? no music. + if (!gme || gme_track_ended(gme)) + return; + + // play gme into stream + gme_play(gme, len/2, (short *)stream); + + // apply volume to stream + for (i = 0, p = (short *)stream; i < len/2; i++, p++) + *p = ((INT32)*p) * music_volume / 31; +} +#endif + +void I_InitMusic(void) +{ +} + +void I_ShutdownMusic(void) +{ + I_ShutdownDigMusic(); + I_ShutdownMIDIMusic(); +} + +void I_PauseSong(INT32 handle) +{ + (void)handle; + Mix_PauseMusic(); +} + +void I_ResumeSong(INT32 handle) +{ + (void)handle; + Mix_ResumeMusic(); +} + +// +// Digital Music +// + +void I_InitDigMusic(void) +{ +#ifdef HAVE_LIBGME + gme = NULL; + current_track = -1; +#endif +} + +void I_ShutdownDigMusic(void) +{ + if (midimode) + return; +#ifdef HAVE_LIBGME + if (gme) + { + Mix_HookMusic(NULL, NULL); + gme_delete(gme); + gme = NULL; + } +#endif + if (!music) + return; + Mix_HookMusicFinished(NULL); + Mix_FreeMusic(music); + music = NULL; +} + +boolean I_StartDigSong(const char *musicname, boolean looping) +{ + char *data; + size_t len; + lumpnum_t lumpnum = W_CheckNumForName(va("O_%s",musicname)); + + I_Assert(!music); +#ifdef HAVE_LIBGME + I_Assert(!gme); +#endif + + if (lumpnum == LUMPERROR) + { + lumpnum = W_CheckNumForName(va("D_%s",musicname)); + if (lumpnum == LUMPERROR) + return false; + midimode = true; + } + else + midimode = false; + + data = (char *)W_CacheLumpNum(lumpnum, PU_MUSIC); + len = W_LumpLength(lumpnum); + +#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 eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0}; + gme_start_track(gme, 0); + current_track = 0; + gme_set_equalizer(gme, &eq); + Mix_HookMusic(mix_gme, gme); + Z_Free(inflatedData); // GME supposedly makes a copy for itself, so we don't need this lying around + 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 eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0}; + gme_start_track(gme, 0); + current_track = 0; + gme_set_equalizer(gme, &eq); + Mix_HookMusic(mix_gme, gme); + return true; + } +#endif + + music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len)); + if (!music) + { + CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError()); + return true; + } + + // Find the OGG loop point. + loop_point = 0.0f; + if (looping) + { + const char *key1 = "LOOP"; + const char *key2 = "POINT="; + const char *key3 = "MS="; + const UINT8 key1len = strlen(key1); + const UINT8 key2len = strlen(key2); + const UINT8 key3len = strlen(key3); + char *p = data; + while ((UINT32)(p - data) < len) + { + if (strncmp(p++, key1, key1len)) + continue; + p += key1len-1; // skip OOP (the L was skipped in strncmp) + if (!strncmp(p, key2, key2len)) // is it LOOPPOINT=? + { + p += key2len; // skip POINT= + loop_point = (float)((44.1L+atoi(p)) / 44100.0L); // LOOPPOINT works by sample count. + // because SDL_Mixer is USELESS and can't even tell us + // something simple like the frequency of the streaming music, + // we are unfortunately forced to assume that ALL MUSIC is 44100hz. + // This means a lot of tracks that are only 22050hz for a reasonable downloadable file size will loop VERY badly. + } + else if (!strncmp(p, key3, key3len)) // is it LOOPMS=? + { + p += key3len; // skip MS= + loop_point = atoi(p) / 1000.0L; // LOOPMS works by real time, as miliseconds. + // Everything that uses LOOPMS will work perfectly with SDL_Mixer. + } + // Neither?! Continue searching. + } + } + + if (Mix_PlayMusic(music, looping && loop_point == 0.0f ? -1 : 0) == -1) + { + CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError()); + return true; + } + if (midimode) + Mix_VolumeMusic((UINT32)midi_volume*128/31); + else + Mix_VolumeMusic((UINT32)music_volume*128/31); + + if (loop_point != 0.0f) + Mix_HookMusicFinished(music_loop); + return true; +} + +void I_StopDigSong(void) +{ + if (midimode) + return; +#ifdef HAVE_LIBGME + if (gme) + { + Mix_HookMusic(NULL, NULL); + gme_delete(gme); + gme = NULL; + current_track = -1; + return; + } +#endif + if (!music) + return; + Mix_HookMusicFinished(NULL); + Mix_FreeMusic(music); + music = NULL; +} + +void I_SetDigMusicVolume(UINT8 volume) +{ + music_volume = volume; + if (midimode || !music) + return; + Mix_VolumeMusic((UINT32)volume*128/31); +} + +boolean I_SetSongSpeed(float speed) +{ + if (speed > 250.0f) + speed = 250.0f; //limit speed up to 250x +#ifdef HAVE_LIBGME + if (gme) + { + SDL_LockAudio(); + gme_set_tempo(gme, speed); + SDL_UnlockAudio(); + return true; + } +#else + (void)speed; +#endif + return false; +} + +boolean I_SetSongTrack(int track) +{ +#ifdef HAVE_LIBGME + if (current_track == track) + return false; + + // If the specified track is within the number of tracks playing, then change it + if (gme) + { + SDL_LockAudio(); + if (track >= 0 + && track < gme_track_count(gme)) + { + gme_err_t gme_e = gme_start_track(gme, track); + if (gme_e != NULL) + { + CONS_Alert(CONS_ERROR, "GME error: %s\n", gme_e); + return false; + } + current_track = track; + SDL_UnlockAudio(); + return true; + } + SDL_UnlockAudio(); + return false; + } +#endif + (void)track; + return false; +} + +// +// MIDI Music +// + +void I_InitMIDIMusic(void) +{ +} + +void I_ShutdownMIDIMusic(void) +{ + if (!midimode || !music) + return; + Mix_FreeMusic(music); + music = NULL; +} + +void I_SetMIDIMusicVolume(UINT8 volume) +{ + midi_volume = volume; + if (!midimode || !music) + return; + Mix_VolumeMusic((UINT32)volume*128/31); +} + +INT32 I_RegisterSong(void *data, size_t len) +{ + music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len)); + if (!music) + { + CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError()); + return -1; + } + return 1337; +} + +boolean I_PlaySong(INT32 handle, boolean looping) +{ + (void)handle; + + midimode = true; + + if (Mix_PlayMusic(music, looping ? -1 : 0) == -1) + { + CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError()); + return false; + } + Mix_VolumeMusic((UINT32)music_volume*128/31); + return true; +} + +void I_StopSong(INT32 handle) +{ + if (!midimode || !music) + return; + + (void)handle; + Mix_HaltMusic(); +} + +void I_UnRegisterSong(INT32 handle) +{ + if (!midimode || !music) + return; + + (void)handle; + Mix_FreeMusic(music); + music = NULL; +} + +#endif diff --git a/src/sdl12/ogl_sdl.c b/src/sdl12/ogl_sdl.c new file mode 100644 index 000000000..e726bf07d --- /dev/null +++ b/src/sdl12/ogl_sdl.c @@ -0,0 +1,315 @@ +// 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 SDL specific part of the OpenGL API for SRB2 + +#ifdef _MSC_VER +#pragma warning(disable : 4214 4244) +#endif + +#ifdef HAVE_SDL + +#include "SDL.h" + +#ifdef _MSC_VER +#pragma warning(default : 4214 4244) +#endif + +#include "../doomdef.h" + +#ifdef HWRENDER +#include "../hardware/r_opengl/r_opengl.h" +#include "ogl_sdl.h" +#include "../i_system.h" +#include "hwsym_sdl.h" +#include "../m_argv.h" + +#ifdef DEBUG_TO_FILE +#include +#if defined (_WIN32) && !defined (__CYGWIN__) +#include +#else +#include +#endif +#include +#include +#endif + +#ifdef USE_WGL_SWAP +PFNWGLEXTSWAPCONTROLPROC wglSwapIntervalEXT = NULL; +#else +typedef int (*PFNGLXSWAPINTERVALPROC) (int); +PFNGLXSWAPINTERVALPROC glXSwapIntervalSGIEXT = NULL; +#endif + +#ifndef STATIC_OPENGL +PFNglClear pglClear; +PFNglGetIntegerv pglGetIntegerv; +PFNglGetString pglGetString; +#endif + +#ifdef _PSP +static const Uint32 WOGLFlags = SDL_HWSURFACE|SDL_OPENGL/*|SDL_RESIZABLE*/; +static const Uint32 FOGLFlags = SDL_HWSURFACE|SDL_OPENGL|SDL_FULLSCREEN; +#else +static const Uint32 WOGLFlags = SDL_OPENGL/*|SDL_RESIZABLE*/; +static const Uint32 FOGLFlags = SDL_OPENGL|SDL_FULLSCREEN; +#endif + +/** \brief SDL video display surface +*/ +SDL_Surface *vidSurface = NULL; +INT32 oglflags = 0; +void *GLUhandle = NULL; + +#ifndef STATIC_OPENGL +void *GetGLFunc(const char *proc) +{ + if (strncmp(proc, "glu", 3) == 0) + { + if (GLUhandle) + return hwSym(proc, GLUhandle); + else + return NULL; + } + return SDL_GL_GetProcAddress(proc); +} +#endif + +boolean LoadGL(void) +{ +#ifndef STATIC_OPENGL + const char *OGLLibname = NULL; + const char *GLULibname = NULL; + + if (M_CheckParm ("-OGLlib") && M_IsNextParm()) + OGLLibname = M_GetNextParm(); + + if (SDL_GL_LoadLibrary(OGLLibname) != 0) + { + I_OutputMsg("Could not load OpenGL Library: %s\n" + "Falling back to Software mode.\n", SDL_GetError()); + if (!M_CheckParm ("-OGLlib")) + I_OutputMsg("If you know what is the OpenGL library's name, use -OGLlib\n"); + return 0; + } + +#if 0 + GLULibname = "/proc/self/exe"; +#elif defined (_WIN32) + GLULibname = "GLU32.DLL"; +#elif defined (__MACH__) + GLULibname = "/System/Library/Frameworks/OpenGL.framework/Libraries/libGLU.dylib"; +#elif defined (macintos) + GLULibname = "OpenGLLibrary"; +#elif defined (__unix__) + GLULibname = "libGLU.so.1"; +#elif defined (__HAIKU__) + GLULibname = "libGLU.so"; +#else + GLULibname = NULL; +#endif + + if (M_CheckParm ("-GLUlib") && M_IsNextParm()) + GLULibname = M_GetNextParm(); + + if (GLULibname) + { + GLUhandle = hwOpen(GLULibname); + if (GLUhandle) + return SetupGLfunc(); + else + { + I_OutputMsg("Could not load GLU Library: %s\n", GLULibname); + if (!M_CheckParm ("-GLUlib")) + I_OutputMsg("If you know what is the GLU library's name, use -GLUlib\n"); + } + } + else + { + I_OutputMsg("Could not load GLU Library\n"); + I_OutputMsg("If you know what is the GLU library's name, use -GLUlib\n"); + } +#endif + return SetupGLfunc(); +} + +/** \brief The OglSdlSurface function + + \param w width + \param h height + \param isFullscreen if true, go fullscreen + + \return if true, changed video mode +*/ +boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen) +{ + INT32 cbpp; + Uint32 OGLFlags; + const GLvoid *glvendor = NULL, *glrenderer = NULL, *glversion = NULL; + + cbpp = cv_scr_depth.value < 16 ? 16 : cv_scr_depth.value; + + if (vidSurface) + { + //Alam: SDL_Video system free vidSurface for me +#ifdef VOODOOSAFESWITCHING + SDL_QuitSubSystem(SDL_INIT_VIDEO); + SDL_InitSubSystem(SDL_INIT_VIDEO); +#endif + } + + if (isFullscreen) + OGLFlags = FOGLFlags; + else + OGLFlags = WOGLFlags; + + cbpp = SDL_VideoModeOK(w, h, cbpp, OGLFlags); + if (cbpp < 16) + return true; //Alam: Let just say we did, ok? + + vidSurface = SDL_SetVideoMode(w, h, cbpp, OGLFlags); + if (!vidSurface) + return false; + + glvendor = pglGetString(GL_VENDOR); + // Get info and extensions. + //BP: why don't we make it earlier ? + //Hurdler: we cannot do that before intialising gl context + glrenderer = pglGetString(GL_RENDERER); + glversion = pglGetString(GL_VERSION); + gl_extensions = pglGetString(GL_EXTENSIONS); + + DBG_Printf("Vendor : %s\n", glvendor); + DBG_Printf("Renderer : %s\n", glrenderer); + DBG_Printf("Version : %s\n", glversion); + DBG_Printf("Extensions : %s\n", gl_extensions); + oglflags = 0; + +#ifdef _WIN32 + // BP: disable advenced feature that don't work on somes hardware + // Hurdler: Now works on G400 with bios 1.6 and certified drivers 6.04 + if (strstr(glrenderer, "810")) oglflags |= GLF_NOZBUFREAD; +#elif defined (unix) || defined (UNIXCOMMON) + // disable advanced features not working on somes hardware + if (strstr(glrenderer, "G200")) oglflags |= GLF_NOTEXENV; + if (strstr(glrenderer, "G400")) oglflags |= GLF_NOTEXENV; +#endif + DBG_Printf("oglflags : 0x%X\n", oglflags ); + +#ifdef USE_PALETTED_TEXTURE + if (isExtAvailable("GL_EXT_paletted_texture", gl_extensions)) + glColorTableEXT = SDL_GL_GetProcAddress("glColorTableEXT"); + else + glColorTableEXT = NULL; +#endif + +#ifdef USE_WGL_SWAP + if (isExtAvailable("WGL_EXT_swap_control", gl_extensions)) + wglSwapIntervalEXT = SDL_GL_GetProcAddress("wglSwapIntervalEXT"); + else + wglSwapIntervalEXT = NULL; +#else + if (isExtAvailable("GLX_SGI_swap_control", gl_extensions)) + glXSwapIntervalSGIEXT = SDL_GL_GetProcAddress("glXSwapIntervalSGI"); + else + glXSwapIntervalSGIEXT = NULL; +#endif + +#ifndef KOS_GL_COMPATIBILITY + if (isExtAvailable("GL_EXT_texture_filter_anisotropic", gl_extensions)) + pglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maximumAnisotropy); + else +#endif + maximumAnisotropy = 0; + + granisotropicmode_cons_t[1].value = maximumAnisotropy; + + SetModelView(w, h); + SetStates(); + pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); + + HWR_Startup(); +#ifdef KOS_GL_COMPATIBILITY + textureformatGL = GL_ARGB4444; +#else + textureformatGL = cbpp > 16 ? GL_RGBA : GL_RGB5_A1; +#endif + + return true; +} + +/** \brief The OglSdlFinishUpdate function + + \param vidwait wait for video sync + + \return void +*/ +void OglSdlFinishUpdate(boolean waitvbl) +{ + static boolean oldwaitvbl = false; + if (oldwaitvbl != waitvbl) + { +#ifdef USE_WGL_SWAP + if (wglSwapIntervalEXT) + wglSwapIntervalEXT(waitvbl); +#else + if (glXSwapIntervalSGIEXT) + glXSwapIntervalSGIEXT(waitvbl); +#endif + } + oldwaitvbl = waitvbl; + + SDL_GL_SwapBuffers(); +} + +EXPORT void HWRAPI( OglSdlSetPalette) (RGBA_t *palette, RGBA_t *pgamma) +{ + INT32 i = -1; + UINT32 redgamma = pgamma->s.red, greengamma = pgamma->s.green, + bluegamma = pgamma->s.blue; + +#if 0 // changing the gamma to 127 is a bad idea + i = SDL_SetGamma(byteasfloat(redgamma), byteasfloat(greengamma), byteasfloat(bluegamma)); +#endif + if (i == 0) redgamma = greengamma = bluegamma = 0x7F; //Alam: cool + for (i = 0; i < 256; i++) + { + myPaletteData[i].s.red = (UINT8)MIN((palette[i].s.red * redgamma) /127, 255); + myPaletteData[i].s.green = (UINT8)MIN((palette[i].s.green * greengamma)/127, 255); + myPaletteData[i].s.blue = (UINT8)MIN((palette[i].s.blue * bluegamma) /127, 255); + myPaletteData[i].s.alpha = palette[i].s.alpha; + } +#ifdef USE_PALETTED_TEXTURE + if (glColorTableEXT) + { + for (i = 0; i < 256; i++) + { + palette_tex[(3*i)+0] = palette[i].s.red; + palette_tex[(3*i)+1] = palette[i].s.green; + palette_tex[(3*i)+2] = palette[i].s.blue; + } + glColorTableEXT(GL_TEXTURE_2D, GL_RGB8, 256, GL_RGB, GL_UNSIGNED_BYTE, palette_tex); + } +#endif + // on a chang�de palette, il faut recharger toutes les textures + // jaja, und noch viel mehr ;-) + Flush(); +} + +#endif //HWRENDER +#endif //SDL diff --git a/src/sdl12/ogl_sdl.h b/src/sdl12/ogl_sdl.h new file mode 100644 index 000000000..43c28fa42 --- /dev/null +++ b/src/sdl12/ogl_sdl.h @@ -0,0 +1,30 @@ +// 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 SDL specific part of the OpenGL API for SRB2 + +#include "../v_video.h" + +extern SDL_Surface *vidSurface; +extern void *GLUhandle; + +boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen); + +void OglSdlFinishUpdate(boolean vidwait); + +#ifdef _CREATE_DLL_ +EXPORT void HWRAPI( OglSdlSetPalette ) (RGBA_t *palette, RGBA_t *pgamma); +#endif diff --git a/src/sdl12/sdl_sound.c b/src/sdl12/sdl_sound.c new file mode 100644 index 000000000..6ba83104e --- /dev/null +++ b/src/sdl12/sdl_sound.c @@ -0,0 +1,2030 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright (C) 1993-1996 by id Software, Inc. +// +// 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. +// +// The source 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 SDL interface for sound + +#include +#include "../doomdef.h" + +#ifdef _MSC_VER +#pragma warning(disable : 4214 4244) +#endif + +#if defined(HAVE_SDL) && SOUND==SOUND_SDL + +#include "SDL.h" + +#ifdef _MSC_VER +#pragma warning(default : 4214 4244) +#endif + +#ifdef HAVE_MIXER +#include "SDL_mixer.h" +/* This is the version number macro for the current SDL_mixer version: */ +#ifndef SDL_MIXER_COMPILEDVERSION +#define SDL_MIXER_COMPILEDVERSION \ + SDL_VERSIONNUM(MIX_MAJOR_VERSION, MIX_MINOR_VERSION, MIX_PATCHLEVEL) +#endif + +/* This macro will evaluate to true if compiled with SDL_mixer at least X.Y.Z */ +#ifndef SDL_MIXER_VERSION_ATLEAST +#define SDL_MIXER_VERSION_ATLEAST(X, Y, Z) \ + (SDL_MIXER_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) +#endif + +#else +#define MIX_CHANNELS 8 +#endif + +#if defined (_WIN32) && !defined (_WIN32_WCE) && !defined (_XBOX) +#include +#elif defined (__GNUC__) +#include +#endif +#include "../z_zone.h" + +#include "../m_swap.h" +#include "../i_system.h" +#include "../i_sound.h" +#include "../m_argv.h" +#include "../m_misc.h" +#include "../w_wad.h" +#include "../screen.h" //vid.WndParent +#include "../doomdef.h" +#include "../doomstat.h" +#include "../s_sound.h" + +#include "../d_main.h" + +#ifdef HW3SOUND +#include "../hardware/hw3dsdrv.h" +#include "../hardware/hw3sound.h" +#include "hwsym_sdl.h" +#endif + +#ifdef HAVE_LIBGME +#include "gme/gme.h" +#endif + +// The number of internal mixing channels, +// the samples calculated for each mixing step, +// the size of the 16bit, 2 hardware channel (stereo) +// mixing buffer, and the samplerate of the raw data. + +// Needed for calling the actual sound output. +#if defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined(GP2X) +#define NUM_CHANNELS MIX_CHANNELS +#else +#define NUM_CHANNELS MIX_CHANNELS*4 +#endif + +#define INDEXOFSFX(x) ((sfxinfo_t *)x - S_sfx) + +#if defined (_WIN32_WCE) || defined (DC) || defined (PSP) +static Uint16 samplecount = 512; //Alam: .5KB samplecount at 11025hz is 46.439909297052154195011337868481ms of buffer +#elif defined(GP2X) +static Uint16 samplecount = 128; +#else +static Uint16 samplecount = 1024; //Alam: 1KB samplecount at 22050hz is 46.439909297052154195011337868481ms of buffer +#endif + +typedef struct chan_struct +{ + // The channel data pointers, start and end. + Uint8 *data; //static unsigned char *channels[NUM_CHANNELS]; + Uint8 *end; //static unsigned char *channelsend[NUM_CHANNELS]; + + // pitch + Uint32 realstep; // The channel step amount... + Uint32 step; //static UINT32 channelstep[NUM_CHANNELS]; + Uint32 stepremainder; //static UINT32 channelstepremainder[NUM_CHANNELS]; + Uint32 samplerate; // ... and a 0.16 bit remainder of last step. + + // Time/gametic that the channel started playing, + // used to determine oldest, which automatically + // has lowest priority. + tic_t starttic; //static INT32 channelstart[NUM_CHANNELS]; + + // The sound handle, determined on registration, + // used to unregister/stop/modify, + INT32 handle; //static INT32 channelhandles[NUM_CHANNELS]; + + // SFX id of the playing sound effect. + void *id; // Used to catch duplicates (like chainsaw). + sfxenum_t sfxid; //static INT32 channelids[NUM_CHANNELS]; + INT32 vol; //the channel volume + INT32 sep; //the channel pan + + // Hardware left and right channel volume lookup. + Sint16* leftvol_lookup; //static INT32 *channelleftvol_lookup[NUM_CHANNELS]; + Sint16* rightvol_lookup; //static INT32 *channelrightvol_lookup[NUM_CHANNELS]; +} chan_t; + +static chan_t channels[NUM_CHANNELS]; + +// Pitch to stepping lookup +static INT32 steptable[256]; + +// Volume lookups. +static Sint16 vol_lookup[128 * 256]; + +UINT8 sound_started = false; +static SDL_mutex *Snd_Mutex = NULL; + +//SDL's Audio +static SDL_AudioSpec audio; + +static SDL_bool musicStarted = SDL_FALSE; +#ifdef HAVE_MIXER +static SDL_mutex *Msc_Mutex = NULL; +/* FIXME: Make this file instance-specific */ +#ifdef _arch_dreamcast +#define MIDI_PATH "/ram" +#elif defined(GP2X) +#define MIDI_PATH "/mnt/sd/srb2" +#define MIDI_PATH2 "/tmp/mnt/sd/srb2" +#else +#define MIDI_PATH srb2home +#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) +#define MIDI_PATH2 "/tmp" +#endif +#endif +#define MIDI_TMPFILE "srb2music" +#define MIDI_TMPFILE2 "srb2wav" +static INT32 musicvol = 62; + +#if SDL_MIXER_VERSION_ATLEAST(1,2,2) +#define MIXER_POS //Mix_FadeInMusicPos in 1.2.2+ +static void SDLCALL I_FinishMusic(void); +static double loopstartDig = 0.0l; +static SDL_bool loopingDig = SDL_FALSE; +static SDL_bool canlooping = SDL_TRUE; +#endif + +#if SDL_MIXER_VERSION_ATLEAST(1,2,7) +#define USE_RWOPS // ok, USE_RWOPS is in here +#if defined (DC) || defined (_WIN32_WCE) || defined (_XBOX) //|| defined(_WIN32) || defined(GP2X) +#undef USE_RWOPS +#endif +#endif + +#if SDL_MIXER_VERSION_ATLEAST(1,2,10) +//#define MIXER_INIT +#endif + +#ifdef USE_RWOPS +static void * Smidi[2] = { NULL, NULL }; +static SDL_bool canuseRW = SDL_TRUE; +#endif +static const char *fmidi[2] = { MIDI_TMPFILE, MIDI_TMPFILE2}; + +static const INT32 MIDIfade = 500; +static const INT32 Digfade = 0; + +static Mix_Music *music[2] = { NULL, NULL }; +#endif + +typedef struct srb2audio_s { + void *userdata; +#ifdef HAVE_LIBGME + Music_Emu *gme_emu; + UINT8 gme_pause; + UINT8 gme_loop; +#endif +} srb2audio_t; + +static srb2audio_t localdata; + +static void Snd_LockAudio(void) //Alam: Lock audio data and uninstall audio callback +{ + if (Snd_Mutex) SDL_LockMutex(Snd_Mutex); + else if (nosound) return; + else if (nomidimusic && nodigimusic +#ifdef HW3SOUND + && hws_mode == HWS_DEFAULT_MODE +#endif + ) SDL_LockAudio(); +#ifdef HAVE_MIXER + else if (musicStarted) Mix_SetPostMix(NULL, NULL); +#endif +} + +static void Snd_UnlockAudio(void) //Alam: Unlock audio data and reinstall audio callback +{ + if (Snd_Mutex) SDL_UnlockMutex(Snd_Mutex); + else if (nosound) return; + else if (nomidimusic && nodigimusic +#ifdef HW3SOUND + && hws_mode == HWS_DEFAULT_MODE +#endif + ) SDL_UnlockAudio(); +#ifdef HAVE_MIXER + else if (musicStarted) Mix_SetPostMix(audio.callback, audio.userdata); +#endif +} + +FUNCMATH static inline Uint16 Snd_LowerRate(Uint16 sr) +{ + if (sr <= audio.freq) // already lowered rate? + return sr; // good then + for (;sr > audio.freq;) // not good? + { // then let see... + if (sr % 2) // can we div by half? + return sr; // no, just use the currect rate + sr /= 2; // we can? wonderful + } // let start over again + if (sr == audio.freq) // did we drop to the desired rate? + return sr; // perfect! but if not + return sr*2; // just keep it just above the output sample rate +} + +#ifdef _MSC_VER +#pragma warning(disable : 4200) +#pragma pack(1) +#endif + +typedef struct +{ + Uint16 header; // 3? + Uint16 samplerate; // 11025+ + Uint16 samples; // number of samples + Uint16 dummy; // 0 + Uint8 data[0]; // data; +} ATTRPACK dssfx_t; + +#ifdef _MSC_VER +#pragma pack() +#pragma warning(default : 4200) +#endif + +// +// This function loads the sound data from the WAD lump, +// for single sound. +// +static void *getsfx(lumpnum_t sfxlump, size_t *len) +{ + dssfx_t *sfx, *paddedsfx; + Uint16 sr , csr; + size_t size = *len; + SDL_AudioCVT sfxcvt; + + sfx = (dssfx_t *)malloc(size); + if (sfx) W_ReadLump(sfxlump, (void *)sfx); + else return NULL; + sr = SHORT(sfx->samplerate); + csr = Snd_LowerRate(sr); + + if (sr > csr && SDL_BuildAudioCVT(&sfxcvt, AUDIO_U8, 1, sr, AUDIO_U8, 1, csr)) + {//Alam: Setup the AudioCVT for the SFX + + sfxcvt.len = (INT32)size-8; //Alam: Chop off the header + sfxcvt.buf = malloc(sfxcvt.len * sfxcvt.len_mult); //Alam: make room + if (sfxcvt.buf) M_Memcpy(sfxcvt.buf, &(sfx->data), sfxcvt.len); //Alam: copy the sfx sample + + if (sfxcvt.buf && SDL_ConvertAudio(&sfxcvt) == 0) //Alam: let convert it! + { + size = sfxcvt.len_cvt + 8; + *len = sfxcvt.len_cvt; + + // Allocate from zone memory. + paddedsfx = (dssfx_t *) Z_Malloc(size, PU_SOUND, NULL); + + // Now copy and pad. + M_Memcpy(paddedsfx->data, sfxcvt.buf, sfxcvt.len_cvt); + free(sfxcvt.buf); + M_Memcpy(paddedsfx,sfx,8); + paddedsfx->samplerate = SHORT(csr); // new freq + } + else //Alam: the convert failed, not needed or I couldn't malloc the buf + { + if (sfxcvt.buf) free(sfxcvt.buf); + *len = size - 8; + + // Allocate from zone memory then copy and pad + paddedsfx = (dssfx_t *)M_Memcpy(Z_Malloc(size, PU_SOUND, NULL), sfx, size); + } + } + else + { + // Pads the sound effect out to the mixing buffer size. + // The original realloc would interfere with zone memory. + *len = size - 8; + + // Allocate from zone memory then copy and pad + paddedsfx = (dssfx_t *)M_Memcpy(Z_Malloc(size, PU_SOUND, NULL), sfx, size); + } + + // Remove the cached lump. + free(sfx); + + // Return allocated padded data. + return paddedsfx; +} + +// used to (re)calculate channel params based on vol, sep, pitch +static void I_SetChannelParams(chan_t *c, INT32 vol, INT32 sep, INT32 step) +{ + INT32 leftvol; + INT32 rightvol; + c->vol = vol; + c->sep = sep; + c->step = c->realstep = step; + + if (step != steptable[128]) + c->step += (((c->samplerate<<16)/audio.freq)-65536); + else if (c->samplerate != (unsigned)audio.freq) + c->step = ((c->samplerate<<16)/audio.freq); + // x^2 separation, that is, orientation/stereo. + // range is: 0 (left) - 255 (right) + + // Volume arrives in range 0..255 and it must be in 0..cv_soundvolume... + vol = (vol * cv_soundvolume.value) >> 7; + // note: >> 6 would use almost the entire dynamical range, but + // then there would be no "dynamical room" for other sounds :-/ + + leftvol = vol - ((vol*sep*sep) >> 16); ///(256*256); + sep = 255 - sep; + rightvol = vol - ((vol*sep*sep) >> 16); + + // Sanity check, clamp volume. + if (rightvol < 0) + rightvol = 0; + else if (rightvol > 127) + rightvol = 127; + if (leftvol < 0) + leftvol = 0; + else if (leftvol > 127) + leftvol = 127; + + // Get the proper lookup table piece + // for this volume level + c->leftvol_lookup = &vol_lookup[leftvol*256]; + c->rightvol_lookup = &vol_lookup[rightvol*256]; +} + +static INT32 FindChannel(INT32 handle) +{ + INT32 i; + + for (i = 0; i < NUM_CHANNELS; i++) + if (channels[i].handle == handle) + return i; + + // not found + return -1; +} + +// +// This function adds a sound to the +// list of currently active sounds, +// which is maintained as a given number +// (eight, usually) of internal channels. +// Returns a handle. +// +static INT32 addsfx(sfxenum_t sfxid, INT32 volume, INT32 step, INT32 seperation) +{ + static UINT16 handlenums = 0; + INT32 i, slot, oldestnum = 0; + tic_t oldest = gametic; + + // Play these sound effects only one at a time. +#if 1 + if ( +#if 0 + sfxid == sfx_stnmov || sfxid == sfx_sawup || sfxid == sfx_sawidl || sfxid == sfx_sawful || sfxid == sfx_sawhit || sfxid == sfx_pistol +#else + ( sfx_litng1 <= sfxid && sfxid >= sfx_litng4 ) + || sfxid == sfx_trfire || sfxid == sfx_alarm || sfxid == sfx_spin + || sfxid == sfx_athun1 || sfxid == sfx_athun2 || sfxid == sfx_rainin +#endif + ) + { + // Loop all channels, check. + for (i = 0; i < NUM_CHANNELS; i++) + { + // Active, and using the same SFX? + if ((channels[i].end) && (channels[i].sfxid == sfxid)) + { + // Reset. + channels[i].end = NULL; + // We are sure that iff, + // there will only be one. + break; + } + } + } +#endif + + // Loop all channels to find oldest SFX. + for (i = 0; (i < NUM_CHANNELS) && (channels[i].end); i++) + { + if (channels[i].starttic < oldest) + { + oldestnum = i; + oldest = channels[i].starttic; + } + } + + // Tales from the cryptic. + // If we found a channel, fine. + // If not, we simply overwrite the first one, 0. + // Probably only happens at startup. + if (i == NUM_CHANNELS) + slot = oldestnum; + else + slot = i; + + channels[slot].end = NULL; + // Okay, in the less recent channel, + // we will handle the new SFX. + // Set pointer to raw data. + channels[slot].data = (Uint8 *)S_sfx[sfxid].data; + channels[slot].samplerate = (channels[slot].data[3]<<8)+channels[slot].data[2]; + channels[slot].data += 8; //Alam: offset of the sound header + + while (FindChannel(handlenums)!=-1) + { + handlenums++; + // Reset current handle number, limited to 0..65535. + if (handlenums == UINT16_MAX) + handlenums = 0; + } + + // Assign current handle number. + // Preserved so sounds could be stopped. + channels[slot].handle = handlenums; + + // Restart steper + channels[slot].stepremainder = 0; + // Should be gametic, I presume. + channels[slot].starttic = gametic; + + I_SetChannelParams(&channels[slot], volume, seperation, step); + + // Preserve sound SFX id, + // e.g. for avoiding duplicates of chainsaw. + channels[slot].id = S_sfx[sfxid].data; + + channels[slot].sfxid = sfxid; + + // Set pointer to end of raw data. + channels[slot].end = channels[slot].data + S_sfx[sfxid].length; + + + // You tell me. + return handlenums; +} + +// +// SFX API +// Note: this was called by S_Init. +// However, whatever they did in the +// old DPMS based DOS version, this +// were simply dummies in the Linux +// version. +// See soundserver initdata(). +// +// Well... To keep compatibility with legacy doom, I have to call this in +// I_InitSound since it is not called in S_Init... (emanne@absysteme.fr) + +static inline void I_SetChannels(void) +{ + // Init internal lookups (raw data, mixing buffer, channels). + // This function sets up internal lookups used during + // the mixing process. + INT32 i; + INT32 j; + + INT32 *steptablemid = steptable + 128; + + if (nosound) + return; + + // This table provides step widths for pitch parameters. + for (i = -128; i < 128; i++) + { + const double po = pow((double)(2.0l), (double)(i / 64.0l)); + steptablemid[i] = (INT32)(po * 65536.0l); + } + + // Generates volume lookup tables + // which also turn the unsigned samples + // into signed samples. + for (i = 0; i < 128; i++) + for (j = 0; j < 256; j++) + { + //From PrDoom + // proff - made this a little bit softer, because with + // full volume the sound clipped badly + vol_lookup[i * 256 + j] = (Sint16)((i * (j - 128) * 256) / 127); + } +} + +void I_SetSfxVolume(UINT8 volume) +{ + INT32 i; + + (void)volume; + //Snd_LockAudio(); + + for (i = 0; i < NUM_CHANNELS; i++) + if (channels[i].end) I_SetChannelParams(&channels[i], channels[i].vol, channels[i].sep, channels[i].realstep); + + //Snd_UnlockAudio(); +} + +void *I_GetSfx(sfxinfo_t *sfx) +{ + if (sfx->lumpnum == LUMPERROR) + sfx->lumpnum = S_GetSfxLumpNum(sfx); +// else if (sfx->lumpnum != S_GetSfxLumpNum(sfx)) +// I_FreeSfx(sfx); + +#ifdef HW3SOUND + if (hws_mode != HWS_DEFAULT_MODE) + return HW3S_GetSfx(sfx); +#endif + + if (sfx->data) + return sfx->data; //Alam: I have it done! + + sfx->length = W_LumpLength(sfx->lumpnum); + + return getsfx(sfx->lumpnum, &sfx->length); + +} + +void I_FreeSfx(sfxinfo_t * sfx) +{ +// if (sfx->lumpnum<0) +// return; + +#ifdef HW3SOUND + if (hws_mode != HWS_DEFAULT_MODE) + { + HW3S_FreeSfx(sfx); + } + else +#endif + { + size_t i; + + for (i = 1; i < NUMSFX; i++) + { + // Alias? Example is the chaingun sound linked to pistol. + if (S_sfx[i].data == sfx->data) + { + if (S_sfx+i != sfx) S_sfx[i].data = NULL; + S_sfx[i].lumpnum = LUMPERROR; + S_sfx[i].length = 0; + } + } + //Snd_LockAudio(); //Alam: too much? + // Loop all channels, check. + for (i = 0; i < NUM_CHANNELS; i++) + { + // Active, and using the same SFX? + if (channels[i].end && channels[i].id == sfx->data) + { + channels[i].end = NULL; // Reset. + } + } + //Snd_UnlockAudio(); //Alam: too much? + Z_Free(sfx->data); + } + sfx->data = NULL; + sfx->lumpnum = LUMPERROR; +} + +// +// Starting a sound means adding it +// to the current list of active sounds +// in the internal channels. +// As the SFX info struct contains +// e.g. a pointer to the raw data, +// it is ignored. +// As our sound handling does not handle +// priority, it is ignored. +// Pitching (that is, increased speed of playback) +// is set, but currently not used by mixing. +// +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +{ + (void)priority; + (void)pitch; + + if (nosound) + return 0; + + if (S_sfx[id].data == NULL) return -1; + + Snd_LockAudio(); + id = addsfx(id, vol, steptable[pitch], sep); + Snd_UnlockAudio(); + + return id; // Returns a handle (not used). +} + +void I_StopSound(INT32 handle) +{ + // You need the handle returned by StartSound. + // Would be looping all channels, + // tracking down the handle, + // an setting the channel to zero. + INT32 i; + + i = FindChannel(handle); + + if (i != -1) + { + //Snd_LockAudio(); //Alam: too much? + channels[i].end = NULL; + //Snd_UnlockAudio(); //Alam: too much? + channels[i].handle = -1; + channels[i].starttic = 0; + } + +} + +boolean I_SoundIsPlaying(INT32 handle) +{ + boolean isplaying = false; + int chan = FindChannel(handle); + if (chan != -1) + isplaying = (channels[chan].end != NULL); + return isplaying; +} + +FUNCINLINE static ATTRINLINE void I_UpdateStream8S(Uint8 *stream, int len) +{ + // Mix current sound data. + // Data, from raw sound + register Sint16 dr; // Right 8bit stream + register Uint8 sample; // Center 8bit sfx + register Sint16 dl; // Left 8bit stream + + // Pointers in audio stream + Sint8 *rightout = (Sint8 *)stream; // currect right + Sint8 *leftout = rightout + 1;// currect left + const Uint8 step = 2; // Step in stream, left and right, thus two. + + INT32 chan; // Mixing channel index. + + // Determine end of the stream + len /= 2; // not 8bit mono samples, 8bit stereo ones + + if (Snd_Mutex) SDL_LockMutex(Snd_Mutex); + + // Mix sounds into the mixing buffer. + // Loop over len + while (len--) + { + // Reset left/right value. + dl = *leftout; + dr = *rightout; + + // Love thy L2 cache - made this a loop. + // Now more channels could be set at compile time + // as well. Thus loop those channels. + for (chan = 0; chan < NUM_CHANNELS; chan++) + { + // Check channel, if active. + if (channels[chan].end) + { +#if 1 + // Get the raw data from the channel. + sample = channels[chan].data[0]; +#else + // linear filtering from PrDoom + sample = (((Uint32)channels[chan].data[0] *(0x10000 - channels[chan].stepremainder)) + + ((Uint32)channels[chan].data[1]) * (channels[chan].stepremainder))) >> 16; +#endif + // Add left and right part + // for this channel (sound) + // to the current data. + // Adjust volume accordingly. + dl = (Sint16)(dl+(channels[chan].leftvol_lookup[sample]>>8)); + dr = (Sint16)(dr+(channels[chan].rightvol_lookup[sample]>>8)); + // Increment stepage + channels[chan].stepremainder += channels[chan].step; + // Check whether we are done. + if (channels[chan].data + (channels[chan].stepremainder >> 16) >= channels[chan].end) + channels[chan].end = NULL; + else + { + // step to next sample + channels[chan].data += (channels[chan].stepremainder >> 16); + // Limit to LSB??? + channels[chan].stepremainder &= 0xffff; + } + } + } + + // Clamp to range. Left hardware channel. + // Has been char instead of short. + + if (dl > 0x7f) + *leftout = 0x7f; + else if (dl < -0x80) + *leftout = -0x80; + else + *leftout = (Sint8)dl; + + // Same for right hardware channel. + if (dr > 0x7f) + *rightout = 0x7f; + else if (dr < -0x80) + *rightout = -0x80; + else + *rightout = (Sint8)dr; + + // Increment current pointers in stream + leftout += step; + rightout += step; + + } + if (Snd_Mutex) SDL_UnlockMutex(Snd_Mutex); +} + +FUNCINLINE static ATTRINLINE void I_UpdateStream8M(Uint8 *stream, int len) +{ + // Mix current sound data. + // Data, from raw sound + register Sint16 d; // Mono 8bit stream + register Uint8 sample; // Center 8bit sfx + + // Pointers in audio stream + Sint8 *monoout = (Sint8 *)stream; // currect mono + const Uint8 step = 1; // Step in stream, left and right, thus two. + + INT32 chan; // Mixing channel index. + + // Determine end of the stream + //len /= 1; // not 8bit mono samples, 8bit mono ones? + + if (Snd_Mutex) SDL_LockMutex(Snd_Mutex); + + // Mix sounds into the mixing buffer. + // Loop over len + while (len--) + { + // Reset left/right value. + d = *monoout; + + // Love thy L2 cache - made this a loop. + // Now more channels could be set at compile time + // as well. Thus loop those channels. + for (chan = 0; chan < NUM_CHANNELS; chan++) + { + // Check channel, if active. + if (channels[chan].end) + { +#if 1 + // Get the raw data from the channel. + sample = channels[chan].data[0]; +#else + // linear filtering from PrDoom + sample = (((Uint32)channels[chan].data[0] *(0x10000 - channels[chan].stepremainder)) + + ((Uint32)channels[chan].data[1]) * (channels[chan].stepremainder))) >> 16; +#endif + // Add left and right part + // for this channel (sound) + // to the current data. + // Adjust volume accordingly. + d = (Sint16)(d+((channels[chan].leftvol_lookup[sample] + channels[chan].rightvol_lookup[sample])>>9)); + // Increment stepage + channels[chan].stepremainder += channels[chan].step; + // Check whether we are done. + if (channels[chan].data + (channels[chan].stepremainder >> 16) >= channels[chan].end) + channels[chan].end = NULL; + else + { + // step to next sample + channels[chan].data += (channels[chan].stepremainder >> 16); + // Limit to LSB??? + channels[chan].stepremainder &= 0xffff; + } + } + } + + // Clamp to range. Left hardware channel. + // Has been char instead of short. + + if (d > 0x7f) + *monoout = 0x7f; + else if (d < -0x80) + *monoout = -0x80; + else + *monoout = (Sint8)d; + + // Increment current pointers in stream + monoout += step; + } + if (Snd_Mutex) SDL_UnlockMutex(Snd_Mutex); +} + +FUNCINLINE static ATTRINLINE void I_UpdateStream16S(Uint8 *stream, int len) +{ + // Mix current sound data. + // Data, from raw sound + register Sint32 dr; // Right 16bit stream + register Uint8 sample; // Center 8bit sfx + register Sint32 dl; // Left 16bit stream + + // Pointers in audio stream + Sint16 *rightout = (Sint16 *)(void *)stream; // currect right + Sint16 *leftout = rightout + 1;// currect left + const Uint8 step = 2; // Step in stream, left and right, thus two. + + INT32 chan; // Mixing channel index. + + // Determine end of the stream + len /= 4; // not 8bit mono samples, 16bit stereo ones + + if (Snd_Mutex) SDL_LockMutex(Snd_Mutex); + + // Mix sounds into the mixing buffer. + // Loop over len + while (len--) + { + // Reset left/right value. + dl = *leftout; + dr = *rightout; + + // Love thy L2 cache - made this a loop. + // Now more channels could be set at compile time + // as well. Thus loop those channels. + for (chan = 0; chan < NUM_CHANNELS; chan++) + { + // Check channel, if active. + if (channels[chan].end) + { +#if 1 + // Get the raw data from the channel. + sample = channels[chan].data[0]; +#else + // linear filtering from PrDoom + sample = (((Uint32)channels[chan].data[0] *(0x10000 - channels[chan].stepremainder)) + + ((Uint32)channels[chan].data[1]) * (channels[chan].stepremainder))) >> 16; +#endif + // Add left and right part + // for this channel (sound) + // to the current data. + // Adjust volume accordingly. + dl += channels[chan].leftvol_lookup[sample]; + dr += channels[chan].rightvol_lookup[sample]; + // Increment stepage + channels[chan].stepremainder += channels[chan].step; + // Check whether we are done. + if (channels[chan].data + (channels[chan].stepremainder >> 16) >= channels[chan].end) + channels[chan].end = NULL; + else + { + // step to next sample + channels[chan].data += (channels[chan].stepremainder >> 16); + // Limit to LSB??? + channels[chan].stepremainder &= 0xffff; + } + } + } + + // Clamp to range. Left hardware channel. + // Has been char instead of short. + + if (dl > 0x7fff) + *leftout = 0x7fff; + else if (dl < -0x8000) + *leftout = -0x8000; + else + *leftout = (Sint16)dl; + + // Same for right hardware channel. + if (dr > 0x7fff) + *rightout = 0x7fff; + else if (dr < -0x8000) + *rightout = -0x8000; + else + *rightout = (Sint16)dr; + + // Increment current pointers in stream + leftout += step; + rightout += step; + + } + if (Snd_Mutex) SDL_UnlockMutex(Snd_Mutex); +} + +FUNCINLINE static ATTRINLINE void I_UpdateStream16M(Uint8 *stream, int len) +{ + // Mix current sound data. + // Data, from raw sound + register Sint32 d; // Mono 16bit stream + register Uint8 sample; // Center 8bit sfx + + // Pointers in audio stream + Sint16 *monoout = (Sint16 *)(void *)stream; // currect mono + const Uint8 step = 1; // Step in stream, left and right, thus two. + + INT32 chan; // Mixing channel index. + + // Determine end of the stream + len /= 2; // not 8bit mono samples, 16bit mono ones + + if (Snd_Mutex) SDL_LockMutex(Snd_Mutex); + + // Mix sounds into the mixing buffer. + // Loop over len + while (len--) + { + // Reset left/right value. + d = *monoout; + + // Love thy L2 cache - made this a loop. + // Now more channels could be set at compile time + // as well. Thus loop those channels. + for (chan = 0; chan < NUM_CHANNELS; chan++) + { + // Check channel, if active. + if (channels[chan].end) + { +#if 1 + // Get the raw data from the channel. + sample = channels[chan].data[0]; +#else + // linear filtering from PrDoom + sample = (((Uint32)channels[chan].data[0] *(0x10000 - channels[chan].stepremainder)) + + ((Uint32)channels[chan].data[1]) * (channels[chan].stepremainder))) >> 16; +#endif + // Add left and right part + // for this channel (sound) + // to the current data. + // Adjust volume accordingly. + d += (channels[chan].leftvol_lookup[sample] + channels[chan].rightvol_lookup[sample])>>1; + // Increment stepage + channels[chan].stepremainder += channels[chan].step; + // Check whether we are done. + if (channels[chan].data + (channels[chan].stepremainder >> 16) >= channels[chan].end) + channels[chan].end = NULL; + else + { + // step to next sample + channels[chan].data += (channels[chan].stepremainder >> 16); + // Limit to LSB??? + channels[chan].stepremainder &= 0xffff; + } + } + } + + // Clamp to range. Left hardware channel. + // Has been char instead of short. + + if (d > 0x7fff) + *monoout = 0x7fff; + else if (d < -0x8000) + *monoout = -0x8000; + else + *monoout = (Sint16)d; + + // Increment current pointers in stream + monoout += step; + } + if (Snd_Mutex) SDL_UnlockMutex(Snd_Mutex); +} + +#ifdef HAVE_LIBGME +static void I_UpdateSteamGME(Music_Emu *emu, INT16 *stream, int len, UINT8 looping) +{ + #define GME_BUFFER_LEN 44100*2048 + // Mix current sound data. + // Data, from raw sound + register Sint32 da; + + static short gme_buffer[GME_BUFFER_LEN]; // a large buffer for gme + Sint16 *in = gme_buffer; + + do + { + int out = min(GME_BUFFER_LEN, len); + if ( gme_play( emu, len, gme_buffer ) ) { } // ignore error + len -= out; + while (out--) + { + //Left + da = *in; + in++; + da += *stream; + stream++; + //Right + da = *in; + in++; + da += *stream; + stream++; + } + if (gme_track_ended( emu )) + { + if (looping) + gme_seek( emu, 0); + else + break; + } + } while ( len ); + #undef GME_BUFFER_LEN +} +#endif + +static void SDLCALL I_UpdateStream(void *userdata, Uint8 *stream, int len) +{ + if (!sound_started || !userdata) + return; + +#if SDL_VERSION_ATLEAST(1,3,0) + if (musicStarted) + memset(stream, 0x00, len); // only work in !AUDIO_U8, that needs 0x80 +#endif + + if ((audio.channels != 1 && audio.channels != 2) || + (audio.format != AUDIO_S8 && audio.format != AUDIO_S16SYS)) + ; // no function to encode this type of stream + else if (audio.channels == 1 && audio.format == AUDIO_S8) + I_UpdateStream8M(stream, len); + else if (audio.channels == 2 && audio.format == AUDIO_S8) + I_UpdateStream8S(stream, len); + else if (audio.channels == 1 && audio.format == AUDIO_S16SYS) + I_UpdateStream16M(stream, len); + else if (audio.channels == 2 && audio.format == AUDIO_S16SYS) + { + I_UpdateStream16S(stream, len); +#ifdef HAVE_LIBGME + if (userdata) + { + srb2audio_t *sa_userdata = userdata; + if (!sa_userdata->gme_pause) + I_UpdateSteamGME(sa_userdata->gme_emu, (INT16 *)stream, len/4, sa_userdata->gme_loop); + } +#endif + + } +} + +void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep, UINT8 pitch) +{ + // Would be using the handle to identify + // on which channel the sound might be active, + // and resetting the channel parameters. + + INT32 i = FindChannel(handle); + + if (i != -1 && channels[i].end) + { + //Snd_LockAudio(); //Alam: too much? + I_SetChannelParams(&channels[i], vol, sep, steptable[pitch]); + //Snd_UnlockAudio(); //Alam: too much? + } + +} + +#ifdef HW3SOUND + +static void *soundso = NULL; + +static INT32 Init3DSDriver(const char *soName) +{ + if (soName) soundso = hwOpen(soName); +#if defined (_WIN32) && defined (_X86_) && !defined (STATIC3DS) + HW3DS.pfnStartup = hwSym("Startup@8",soundso); + HW3DS.pfnShutdown = hwSym("Shutdown@0",soundso); + HW3DS.pfnAddSfx = hwSym("AddSfx@4",soundso); + HW3DS.pfnAddSource = hwSym("AddSource@8",soundso); + HW3DS.pfnStartSource = hwSym("StartSource@4",soundso); + HW3DS.pfnStopSource = hwSym("StopSource@4",soundso); + HW3DS.pfnGetHW3DSVersion = hwSym("GetHW3DSVersion@0",soundso); + HW3DS.pfnBeginFrameUpdate = hwSym("BeginFrameUpdate@0",soundso); + HW3DS.pfnEndFrameUpdate = hwSym("EndFrameUpdate@0",soundso); + HW3DS.pfnIsPlaying = hwSym("IsPlaying@4",soundso); + HW3DS.pfnUpdateListener = hwSym("UpdateListener@8",soundso); + HW3DS.pfnUpdateSourceParms = hwSym("UpdateSourceParms@12",soundso); + HW3DS.pfnSetCone = hwSym("SetCone@8",soundso); + HW3DS.pfnSetGlobalSfxVolume = hwSym("SetGlobalSfxVolume@4",soundso); + HW3DS.pfnUpdate3DSource = hwSym("Update3DSource@8",soundso); + HW3DS.pfnReloadSource = hwSym("ReloadSource@8",soundso); + HW3DS.pfnKillSource = hwSym("KillSource@4",soundso); + HW3DS.pfnKillSfx = hwSym("KillSfx@4",soundso); + HW3DS.pfnGetHW3DSTitle = hwSym("GetHW3DSTitle@8",soundso); +#else + HW3DS.pfnStartup = hwSym("Startup",soundso); + HW3DS.pfnShutdown = hwSym("Shutdown",soundso); + HW3DS.pfnAddSfx = hwSym("AddSfx",soundso); + HW3DS.pfnAddSource = hwSym("AddSource",soundso); + HW3DS.pfnStartSource = hwSym("StartSource",soundso); + HW3DS.pfnStopSource = hwSym("StopSource",soundso); + HW3DS.pfnGetHW3DSVersion = hwSym("GetHW3DSVersion",soundso); + HW3DS.pfnBeginFrameUpdate = hwSym("BeginFrameUpdate",soundso); + HW3DS.pfnEndFrameUpdate = hwSym("EndFrameUpdate",soundso); + HW3DS.pfnIsPlaying = hwSym("IsPlaying",soundso); + HW3DS.pfnUpdateListener = hwSym("UpdateListener",soundso); + HW3DS.pfnUpdateSourceParms = hwSym("UpdateSourceParms",soundso); + HW3DS.pfnSetCone = hwSym("SetCone",soundso); + HW3DS.pfnSetGlobalSfxVolume = hwSym("SetGlobalSfxVolume",soundso); + HW3DS.pfnUpdate3DSource = hwSym("Update3DSource",soundso); + HW3DS.pfnReloadSource = hwSym("ReloadSource",soundso); + HW3DS.pfnKillSource = hwSym("KillSource",soundso); + HW3DS.pfnKillSfx = hwSym("KillSfx",soundso); + HW3DS.pfnGetHW3DSTitle = hwSym("GetHW3DSTitle",soundso); +#endif + +// if (HW3DS.pfnUpdateListener2 && HW3DS.pfnUpdateListener2 != soundso) + return true; +// else +// return false; +} +#endif + +void I_ShutdownSound(void) +{ + if (nosound || !sound_started) + return; + + CONS_Printf("I_ShutdownSound: "); + +#ifdef HW3SOUND + if (hws_mode != HWS_DEFAULT_MODE) + { + HW3S_Shutdown(); + hwClose(soundso); + return; + } +#endif + + if (nomidimusic && nodigimusic) + SDL_CloseAudio(); + CONS_Printf("%s", M_GetText("shut down\n")); + sound_started = false; + SDL_QuitSubSystem(SDL_INIT_AUDIO); + if (Snd_Mutex) + SDL_DestroyMutex(Snd_Mutex); + Snd_Mutex = NULL; +} + +void I_UpdateSound(void) +{ +} + +void I_StartupSound(void) +{ +#ifdef HW3SOUND + const char *sdrv_name = NULL; +#endif +#ifndef HAVE_MIXER + nomidimusic = nodigimusic = true; +#endif +#ifdef DC + //nosound = true; +#ifdef HAVE_MIXER + nomidimusic = true; + nodigimusic = true; +#endif +#endif + + memset(channels, 0, sizeof (channels)); //Alam: Clean it + + audio.format = AUDIO_S16SYS; + audio.channels = 2; + audio.callback = I_UpdateStream; + audio.userdata = &localdata; + + if (dedicated) + { + nosound = nomidimusic = nodigimusic = true; + return; + } + + // Configure sound device + CONS_Printf("I_StartupSound:\n"); + + // Open the audio device + if (M_CheckParm ("-freq") && M_IsNextParm()) + { + audio.freq = atoi(M_GetNextParm()); + if (!audio.freq) audio.freq = cv_samplerate.value; + audio.samples = (Uint16)((samplecount/2)*(INT32)(audio.freq/11025)); //Alam: to keep it around the same XX ms + CONS_Printf (M_GetText(" requested frequency of %d hz\n"), audio.freq); + } + else + { + audio.samples = samplecount; + audio.freq = cv_samplerate.value; + } + + if (M_CheckParm ("-mono")) + { + audio.channels = 1; + audio.samples /= 2; + } + +#if defined (_PSP) && defined (HAVE_MIXER) // Bug in PSP's SDL_OpenAudio, can not open twice + I_SetChannels(); + sound_started = true; + Snd_Mutex = SDL_CreateMutex(); +#else + if (nosound) +#endif + return; + +#ifdef HW3SOUND +#ifdef STATIC3DS + if (M_CheckParm("-3dsound") || M_CheckParm("-ds3d")) + { + hws_mode = HWS_OPENAL; + } +#elif defined (_WIN32) + if (M_CheckParm("-ds3d")) + { + hws_mode = HWS_DS3D; + sdrv_name = "s_ds3d.dll"; + } + else if (M_CheckParm("-fmod3d")) + { + hws_mode = HWS_FMOD3D; + sdrv_name = "s_fmod.dll"; + } + else if (M_CheckParm("-openal")) + { + hws_mode = HWS_OPENAL; + sdrv_name = "s_openal.dll"; + } +#else + if (M_CheckParm("-fmod3d")) + { + hws_mode = HWS_FMOD3D; + sdrv_name = "./s_fmod.so"; + } + else if (M_CheckParm("-openal")) + { + hws_mode = HWS_OPENAL; + sdrv_name = "./s_openal.so"; + } +#endif + else if (M_CheckParm("-sounddriver") && M_IsNextParm()) + { + hws_mode = HWS_OTHER; + sdrv_name = M_GetNextParm(); + } + if (hws_mode != HWS_DEFAULT_MODE) + { + if (Init3DSDriver(sdrv_name)) + { + snddev_t snddev; + + //nosound = true; + //I_AddExitFunc(I_ShutdownSound); + snddev.bps = 16; + snddev.sample_rate = audio.freq; + snddev.numsfxs = NUMSFX; +#if defined (_WIN32) && !defined (_XBOX) + snddev.cooplevel = 0x00000002; + snddev.hWnd = vid.WndParent; +#endif + if (HW3S_Init(I_Error, &snddev)) + { + audio.userdata = NULL; + CONS_Printf("%s", M_GetText(" Using 3D sound driver\n")); + return; + } + CONS_Printf("%s", M_GetText(" Failed loading 3D sound driver\n")); + // Falls back to default sound system + HW3S_Shutdown(); + hwClose(soundso); + } + CONS_Printf("%s", M_GetText(" Failed loading 3D sound driver\n")); + hws_mode = HWS_DEFAULT_MODE; + } +#endif + if (!musicStarted && SDL_OpenAudio(&audio, &audio) < 0) + { + CONS_Printf("%s", M_GetText(" couldn't open audio with desired format\n")); + nosound = true; + return; + } + else + { + char ad[100]; + CONS_Printf(M_GetText(" Starting up with audio driver : %s\n"), SDL_AudioDriverName(ad, (int)sizeof ad)); + } + samplecount = audio.samples; + CV_SetValue(&cv_samplerate, audio.freq); + CONS_Printf(M_GetText(" configured audio device with %d samples/slice at %ikhz(%dms buffer)\n"), samplecount, audio.freq/1000, (INT32) (((float)audio.samples * 1000.0f) / audio.freq)); + // Finished initialization. + CONS_Printf("%s", M_GetText(" Sound module ready\n")); + //[segabor] + if (!musicStarted) SDL_PauseAudio(0); + //Mix_Pause(0); + I_SetChannels(); + sound_started = true; + Snd_Mutex = SDL_CreateMutex(); +} + +// +// MUSIC API. +// + +void I_ShutdownMIDIMusic(void) +{ + nomidimusic = false; + if (nodigimusic) I_ShutdownMusic(); +} + +#ifdef HAVE_LIBGME +static void I_ShutdownGMEMusic(void) +{ + Snd_LockAudio(); + if (localdata.gme_emu) + gme_delete(localdata.gme_emu); + localdata.gme_emu = NULL; + Snd_UnlockAudio(); +} +#endif + +void I_ShutdownDigMusic(void) +{ + nodigimusic = false; + if (nomidimusic) I_ShutdownMusic(); +} + +#ifdef HAVE_MIXER +static boolean LoadSong(void *data, size_t lumplength, size_t selectpos) +{ + FILE *midfile; + const char *tempname; +#ifdef USE_RWOPS + if (canuseRW) + { + SDL_RWops *SDLRW; + void *olddata = Smidi[selectpos]; //quick shortcut to set + + Z_Free(olddata); //free old memory + Smidi[selectpos] = NULL; + + if (!data) + return olddata != NULL; //was there old data? + + SDLRW = SDL_RWFromConstMem(data, (int)lumplength); //new RWops from Z_zone + if (!SDLRW) //ERROR while making RWops! + { + CONS_Printf(M_GetText("Couldn't load music lump: %s\n"), SDL_GetError()); + Z_Free(data); + return false; + } + + music[selectpos] = Mix_LoadMUS_RW(SDLRW); // new Mix_Chuck from RWops + if (music[selectpos]) + Smidi[selectpos] = data; //all done + else //ERROR while making Mix_Chuck + { + CONS_Printf(M_GetText("Couldn't load music data: %s\n"), Mix_GetError()); + Z_Free(data); + SDL_RWclose(SDLRW); + Smidi[selectpos] = NULL; + } + return true; + } +#endif + tempname = va("%s/%s", MIDI_PATH, fmidi[selectpos]); + + if (!data) + { + if (FIL_FileExists(tempname)) + return unlink(tempname)+1; +#ifdef MIDI_PATH2 + else if (FIL_FileExists(tempname = va("%s/%s", MIDI_PATH2, fmidi[selectpos]))) + return unlink(tempname)+1; +#endif + else + return false; + } + + midfile = fopen(tempname, "wb"); + +#ifdef MIDI_PATH2 + if (!midfile) + { + tempname = va("%s/%s", MIDI_PATH2, fmidi[selectpos]); + midfile = fopen(tempname, "wb"); + } +#endif + + if (!midfile) + { + CONS_Printf(M_GetText("Couldn't open file %s to write music in\n"), tempname); + Z_Free(data); + return false; + } + + if (fwrite(data, lumplength, 1, midfile) == 0) + { + CONS_Printf(M_GetText("Couldn't write music into file %s because %s\n"), tempname, strerror(ferror(midfile))); + Z_Free(data); + fclose(midfile); + return false; + } + + fclose(midfile); + + Z_Free(data); + + music[selectpos] = Mix_LoadMUS(tempname); + if (!music[selectpos]) //ERROR while making Mix_Chuck + { + CONS_Printf(M_GetText("Couldn't load music file %s: %s\n"), tempname, Mix_GetError()); + return false; + } + return true; +} +#endif + + +void I_ShutdownMusic(void) +{ +#ifdef HAVE_MIXER + if ((nomidimusic && nodigimusic) || !musicStarted) + return; + + CONS_Printf("%s", M_GetText("I_ShutdownMusic: ")); + + I_UnRegisterSong(0); + I_StopDigSong(); + Mix_CloseAudio(); +#ifdef MIX_INIT + Mix_Quit(); +#endif + CONS_Printf("%s", M_GetText("shut down\n")); + musicStarted = SDL_FALSE; + if (Msc_Mutex) + SDL_DestroyMutex(Msc_Mutex); + Msc_Mutex = NULL; +#endif +} + +void I_InitMIDIMusic(void) +{ + if (nodigimusic) I_InitMusic(); +} + +void I_InitDigMusic(void) +{ + if (nomidimusic) I_InitMusic(); +} + +void I_InitMusic(void) +{ +#ifdef HAVE_MIXER + char ad[100]; + SDL_version MIXcompiled; + const SDL_version *MIXlinked; +#ifdef MIXER_INIT + const int mixstart = MIX_INIT_OGG; + int mixflags; +#endif +#endif +#ifdef HAVE_LIBGME + I_AddExitFunc(I_ShutdownGMEMusic); +#endif + + if ((nomidimusic && nodigimusic) || dedicated) + return; + +#ifdef HAVE_MIXER + MIX_VERSION(&MIXcompiled) + MIXlinked = Mix_Linked_Version(); + I_OutputMsg("Compiled for SDL_mixer version: %d.%d.%d\n", + MIXcompiled.major, MIXcompiled.minor, MIXcompiled.patch); +#ifdef MIXER_POS +#ifndef _WII + if (MIXlinked->major == 1 && MIXlinked->minor == 2 && MIXlinked->patch < 7) +#endif + canlooping = SDL_FALSE; +#endif +#ifdef USE_RWOPS + if (M_CheckParm("-noRW")) + canuseRW = SDL_FALSE; +#endif + I_OutputMsg("Linked with SDL_mixer version: %d.%d.%d\n", + MIXlinked->major, MIXlinked->minor, MIXlinked->patch); +#if !(defined (DC) || defined (PSP) || defined(GP2X) || defined (WII)) + if (audio.freq < 44100 && !M_CheckParm ("-freq")) //I want atleast 44Khz + { + audio.samples = (Uint16)(audio.samples*(INT32)(44100/audio.freq)); + audio.freq = 44100; //Alam: to keep it around the same XX ms + } +#endif + + if (sound_started +#ifdef HW3SOUND + && hws_mode == HWS_DEFAULT_MODE +#endif + ) + { + I_OutputMsg("Temp Shutdown of SDL Audio System"); + SDL_CloseAudio(); + I_OutputMsg(" Done\n"); + } + + CONS_Printf("%s", M_GetText("I_InitMusic:")); + +#ifdef MIXER_INIT + mixflags = Mix_Init(mixstart); + if ((mixstart & MIX_INIT_FLAC) != (mixflags & MIX_INIT_FLAC)) + { + CONS_Printf("%s", M_GetText(" Unable to load FLAC support\n")); + } + if ((mixstart & MIX_INIT_MOD ) != (mixflags & MIX_INIT_MOD )) + { + CONS_Printf("%s", M_GetText(" Unable to load MOD support\n")); + } + if ((mixstart & MIX_INIT_MP3 ) != (mixflags & MIX_INIT_MP3 )) + { + CONS_Printf("%s", M_GetText(" Unable to load MP3 support\n")); + } + if ((mixstart & MIX_INIT_OGG ) != (mixflags & MIX_INIT_OGG )) + { + CONS_Printf("%s", M_GetText(" Unable to load OGG support\n")); + } +#endif + + if (Mix_OpenAudio(audio.freq, audio.format, audio.channels, audio.samples) < 0) //open_music(&audio) + { + CONS_Printf(M_GetText(" Unable to open music: %s\n"), Mix_GetError()); + nomidimusic = nodigimusic = true; + if (sound_started +#ifdef HW3SOUND + && hws_mode == HWS_DEFAULT_MODE +#endif + ) + { + if (SDL_OpenAudio(&audio, NULL) < 0) //retry + { + CONS_Printf("%s", M_GetText(" couldn't open audio with desired format\n")); + nosound = true; + sound_started = false; + } + else + { + CONS_Printf(M_GetText(" Starting with audio driver : %s\n"), SDL_AudioDriverName(ad, (int)sizeof ad)); + } + } + return; + } + else + CONS_Printf(M_GetText(" Starting up with audio driver : %s with SDL_Mixer\n"), SDL_AudioDriverName(ad, (int)sizeof ad)); + + samplecount = audio.samples; + CV_SetValue(&cv_samplerate, audio.freq); + if (sound_started +#ifdef HW3SOUND + && hws_mode == HWS_DEFAULT_MODE +#endif + ) + I_OutputMsg(" Reconfigured SDL Audio System"); + else I_OutputMsg(" Configured SDL_Mixer System"); + I_OutputMsg(" with %d samples/slice at %ikhz(%dms buffer)\n", samplecount, audio.freq/1000, (INT32) ((audio.samples * 1000.0f) / audio.freq)); + Mix_SetPostMix(audio.callback, audio.userdata); // after mixing music, add sound effects + Mix_Resume(-1); + CONS_Printf("%s", M_GetText("Music initialized\n")); + musicStarted = SDL_TRUE; + Msc_Mutex = SDL_CreateMutex(); +#endif +} + +boolean I_PlaySong(INT32 handle, boolean looping) +{ + (void)handle; +#ifdef HAVE_MIXER + if (nomidimusic || !musicStarted || !music[handle]) + return false; + +#ifdef MIXER_POS + if (canlooping) + Mix_HookMusicFinished(NULL); +#endif + + if (Mix_FadeInMusic(music[handle], looping ? -1 : 0, MIDIfade) == -1) + CONS_Printf(M_GetText("Couldn't play song because %s\n"), Mix_GetError()); + else + { + Mix_VolumeMusic(musicvol); + return true; + } +#else + (void)looping; +#endif + return false; +} + +static void I_PauseGME(void) +{ +#ifdef HAVE_LIBGME + localdata.gme_pause = true; +#endif +} + +void I_PauseSong(INT32 handle) +{ + (void)handle; + I_PauseGME(); +#ifdef HAVE_MIXER + if ((nomidimusic && nodigimusic) || !musicStarted) + return; + + Mix_PauseMusic(); + //I_StopSong(handle); +#endif +} + +static void I_ResumeGME(void) +{ +#ifdef HAVE_LIBGME + localdata.gme_pause = false; +#endif +} + +void I_ResumeSong(INT32 handle) +{ + (void)handle; + I_ResumeGME(); +#ifdef HAVE_MIXER + if ((nomidimusic && nodigimusic) || !musicStarted) + return; + + Mix_VolumeMusic(musicvol); + Mix_ResumeMusic(); + //I_PlaySong(handle, true); +#endif +} + +void I_StopSong(INT32 handle) +{ + (void)handle; +#ifdef HAVE_MIXER + if (nomidimusic || !musicStarted) + return; + Mix_FadeOutMusic(MIDIfade); +#endif +} + +void I_UnRegisterSong(INT32 handle) +{ +#ifdef HAVE_MIXER + + if (nomidimusic || !musicStarted) + return; + + Mix_HaltMusic(); + while (Mix_PlayingMusic()) + ; + + if (music[handle]) + Mix_FreeMusic(music[handle]); + music[handle] = NULL; + LoadSong(NULL, 0, handle); +#else + (void)handle; +#endif +} + +INT32 I_RegisterSong(void *data, size_t len) +{ +#ifdef HAVE_MIXER + if (nomidimusic || !musicStarted) + return false; + + if (!LoadSong(data, len, 0)) + return false; + + if (music[0]) + return true; + + CONS_Printf(M_GetText("Couldn't load MIDI: %s\n"), Mix_GetError()); +#else + (void)len; + (void)data; +#endif + return false; +} + +void I_SetMIDIMusicVolume(UINT8 volume) +{ +#ifdef HAVE_MIXER + if ((nomidimusic && nodigimusic) || !musicStarted) + return; + + if (Msc_Mutex) SDL_LockMutex(Msc_Mutex); + musicvol = volume * 2; + if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex); + Mix_VolumeMusic(musicvol); +#else + (void)volume; +#endif +} + +#ifdef HAVE_LIBGME +static void I_CleanupGME(void *userdata) +{ + Z_Free(userdata); +} +#endif + +static boolean I_StartGMESong(const char *musicname, boolean looping) +{ +#ifdef HAVE_LIBGME + XBOXSTATIC char filename[9]; + void *data; + lumpnum_t lumpnum; + size_t lumplength; + Music_Emu *emu; + const char* gme_err; + + Snd_LockAudio(); + if (localdata.gme_emu) + gme_delete(localdata.gme_emu); + localdata.gme_emu = NULL; + Snd_UnlockAudio(); + + snprintf(filename, sizeof filename, "o_%s", musicname); + + lumpnum = W_CheckNumForName(filename); + + if (lumpnum == LUMPERROR) + { + return false; // No music found. Oh well! + } + else + lumplength = W_LumpLength(lumpnum); + + data = W_CacheLumpNum(lumpnum, PU_MUSIC); + + gme_err = gme_open_data(data, (long)lumplength, &emu, audio.freq); + if (gme_err != NULL) { + //I_OutputMsg("I_StartGMESong: error %s\n",gme_err); + return false; + } + gme_set_user_data(emu, data); + gme_set_user_cleanup(emu, I_CleanupGME); + gme_start_track(emu, 0); + gme_set_fade(emu, Digfade); + + Snd_LockAudio(); + localdata.gme_emu = emu; + localdata.gme_pause = false; + localdata.gme_loop = (UINT8)looping; + Snd_UnlockAudio(); + + return true; +#else + (void)musicname; + (void)looping; +#endif + return false; +} + +boolean I_StartDigSong(const char *musicname, boolean looping) +{ +#ifdef HAVE_MIXER + XBOXSTATIC char filename[9]; + void *data; + lumpnum_t lumpnum; + size_t lumplength; +#endif + + if(I_StartGMESong(musicname, looping)) + return true; + +#ifdef HAVE_MIXER + if (nodigimusic) + return false; + + snprintf(filename, sizeof filename, "o_%s", musicname); + + lumpnum = W_CheckNumForName(filename); + + I_StopDigSong(); + + if (lumpnum == LUMPERROR) + { + // Alam_GBC: like in win32/win_snd.c: Graue 02-29-2004: don't worry about missing music, there might still be a MIDI + //I_OutputMsg("Music lump %s not found!\n", filename); + return false; // No music found. Oh well! + } + else + lumplength = W_LumpLength(lumpnum); + + data = W_CacheLumpNum(lumpnum, PU_MUSIC); + + if (Msc_Mutex) SDL_LockMutex(Msc_Mutex); + +#ifdef MIXER_POS + if (canlooping && (loopingDig = looping) == SDL_TRUE && strcmp(data, "OggS") == 0) + looping = false; // Only on looping Ogg files, will we will do our own looping + + // Scan the Ogg Vorbis file for the COMMENT= field for a custom + // loop point + if (!looping && loopingDig) + { + size_t scan; + const char *dataum = data; + XBOXSTATIC char looplength[64]; + UINT32 loopstart = 0; + UINT8 newcount = 0; + + Mix_HookMusicFinished(I_FinishMusic); + + for (scan = 0; scan < lumplength; 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++ == '=') + { + + while (*dataum != 1 && newcount != 63) + looplength[newcount++] = *dataum++; + + looplength[newcount] = '\0'; + + 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) + { + loopstartDig = (double)((44.1l+loopstart) / 44100.0l); //8 PCM chucks off and PCM to secs +//#ifdef GP2X//#ifdef PARANOIA + //I_OutputMsg("I_StartDigSong: setting looping point to %ul PCMs(%f seconds)\n", loopstart, loopstartDig); +//#endif + } + else + { + looping = true; // loopingDig true, but couldn't find start loop point + } + } + else + loopstartDig = 0.0l; +#else + if (looping && strcmp(data, "OggS") == 0) + I_OutputMsg("I_StartDigSong: SRB2 was not compiled with looping music support(no Mix_FadeInMusicPos)\n"); +#endif + + if (!LoadSong(data, lumplength, 1)) + { + if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex); + return false; + } + + // Note: LoadSong() frees the data. Let's make sure + // we don't try to use the data again. + data = NULL; + + if (Mix_FadeInMusic(music[1], looping ? -1 : 0, Digfade) == -1) + { + if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex); + I_OutputMsg("I_StartDigSong: Couldn't play song %s because %s\n", musicname, Mix_GetError()); + return false; + } + Mix_VolumeMusic(musicvol); + + if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex); + return true; +#else + (void)looping; + (void)musicname; + return false; +#endif +} + +static void I_StopGME(void) +{ +#ifdef HAVE_LIBGME + Snd_LockAudio(); + gme_seek(localdata.gme_emu, 0); + Snd_UnlockAudio(); +#endif +} + +void I_StopDigSong(void) +{ + I_StopGME(); +#ifdef HAVE_MIXER + if (nodigimusic) + return; + +#ifdef MIXER_POS + if (canlooping) + Mix_HookMusicFinished(NULL); +#endif + + Mix_HaltMusic(); + while (Mix_PlayingMusic()) + ; + + if (music[1]) + Mix_FreeMusic(music[1]); + music[1] = NULL; + LoadSong(NULL, 0, 1); +#endif +} + +void I_SetDigMusicVolume(UINT8 volume) +{ + I_SetMIDIMusicVolume(volume); +} + +boolean I_SetSongSpeed(float speed) +{ + + (void)speed; + return false; +} + +boolean I_SetSongTrack(int track) +{ + (void)track; + return false; +} + +#ifdef MIXER_POS +static void SDLCALL I_FinishMusic(void) +{ + if (!music[1]) + return; + else if (Msc_Mutex) SDL_LockMutex(Msc_Mutex); +// I_OutputMsg("I_FinishMusic: Loopping song to %g seconds\n", loopstartDig); + + if (Mix_FadeInMusicPos(music[1], loopstartDig ? 0 : -1, Digfade, loopstartDig) == 0) + Mix_VolumeMusic(musicvol); + else + I_OutputMsg("I_FinishMusic: Couldn't loop song because %s\n", Mix_GetError()); + + if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex); +} +#endif +#endif //HAVE_SDL diff --git a/src/sdl12/sdlmain.h b/src/sdl12/sdlmain.h new file mode 100644 index 000000000..1e497b10d --- /dev/null +++ b/src/sdl12/sdlmain.h @@ -0,0 +1,65 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright (C) 2006 by Sonic Team Jr. +// +// 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 System specific interface stuff. + +#ifndef __sdlmain__ +#define __sdlmain__ + +extern SDL_bool consolevent; +extern SDL_bool framebuffer; + +/** \brief The JoyInfo_s struct + + info about joystick +*/ +typedef struct SDLJoyInfo_s +{ + /// Joystick handle + SDL_Joystick *dev; + /// number of old joystick + int oldjoy; + /// number of axies + int axises; + /// scale of axises + INT32 scale; + /// number of buttons + int buttons; + /// number of hats + int hats; + /// number of balls + int balls; + +} SDLJoyInfo_t; + +/** \brief SDL info about joystick 1 +*/ +extern SDLJoyInfo_t JoyInfo; + +/** \brief joystick axis deadzone +*/ +#define SDL_JDEADZONE 153 +#undef SDL_JDEADZONE + +/** \brief SDL inof about joystick 2 +*/ +extern SDLJoyInfo_t JoyInfo2; + +void I_GetConsoleEvents(void); + +void SDLforceUngrabMouse(void); + +#endif diff --git a/src/sdl12/srb2.ttf b/src/sdl12/srb2.ttf new file mode 100644 index 000000000..53f4c6a28 Binary files /dev/null and b/src/sdl12/srb2.ttf differ diff --git a/src/sounds.h b/src/sounds.h index ee1e60ba1..c5851a346 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -36,7 +36,6 @@ typedef enum SKSSPNDSH, SKSZOOM, SKSSKID, - SKSRADIO, SKSGASP, SKSJUMP, NUMSKINSOUNDS diff --git a/src/st_stuff.c b/src/st_stuff.c index 4bba8eb52..ae8c2f500 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -759,7 +759,7 @@ static void ST_drawLevelTitle(void) } if (actnum) - V_DrawScaledPatch(SCX(ttlnumxpos), SCZ(zoney), V_NOSCALESTART, ttlnum); + V_DrawScaledPatch(ttlnumxpos, zoney, 0, ttlnum); V_DrawLevelTitle(lvlttlxpos, lvlttly, 0, lvlttl); @@ -1906,6 +1906,8 @@ static void ST_overlayDrawer(void) V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(60), V_HUDTRANSHALF, M_GetText("You are a spectator.")); if (G_GametypeHasTeams()) V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), V_HUDTRANSHALF, M_GetText("Press Fire to be assigned to a team.")); + else if (G_IsSpecialStage(gamemap) && useNightsSS) + V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), V_HUDTRANSHALF, M_GetText("You cannot join the game until the stage has ended.")); else V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), V_HUDTRANSHALF, M_GetText("Press Fire to enter the game.")); V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(148), V_HUDTRANSHALF, M_GetText("Press F12 to watch another player.")); diff --git a/src/v_video.c b/src/v_video.c index 9daead788..52fefe4c6 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -75,6 +75,10 @@ consvar_t cv_grdynamiclighting = {"gr_dynamiclighting", "On", CV_SAVE, CV_OnOff, consvar_t cv_grstaticlighting = {"gr_staticlighting", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grcoronas = {"gr_coronas", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grcoronasize = {"gr_coronasize", "1", CV_SAVE| CV_FLOAT, 0, NULL, 0, NULL, NULL, 0, 0, NULL}; + +static CV_PossibleValue_t CV_MD2[] = {{0, "Off"}, {1, "On"}, {2, "Old"}, {0, NULL}}; +// console variables in development +consvar_t cv_grmd2 = {"gr_md2", "Off", CV_SAVE, CV_MD2, NULL, 0, NULL, NULL, 0, 0, NULL}; #endif const UINT8 gammatable[5][256] = @@ -191,7 +195,7 @@ const char *R_GetPalname(UINT16 num) static char palname[9]; char newpal[9] = "PLAYPAL"; - if (num <= 9999) + if (num > 0 && num <= 10000) snprintf(newpal, 8, "PAL%04u", num-1); strncpy(palname, newpal, 8); @@ -222,7 +226,7 @@ void V_SetPalette(INT32 palettenum) #ifdef HWRENDER if (rendermode != render_soft && rendermode != render_none) HWR_SetPalette(&pLocalPalette[palettenum*256]); -#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL) +#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) else #endif #endif @@ -236,7 +240,7 @@ void V_SetPaletteLump(const char *pal) #ifdef HWRENDER if (rendermode != render_soft && rendermode != render_none) HWR_SetPalette(pLocalPalette); -#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL) +#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) else #endif #endif @@ -926,11 +930,9 @@ void V_DrawPatchFill(patch_t *pat) // void V_DrawFadeScreen(void) { - INT32 x, y, w; - INT32 *buf; - UINT32 quad; - UINT8 p1, p2, p3, p4; - const UINT8 *fadetable = (UINT8 *)colormaps + 16*256, *deststop = screens[0] + vid.rowbytes * vid.height; + const UINT8 *fadetable = (UINT8 *)colormaps + 16*256; + const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height; + UINT8 *buf = screens[0]; #ifdef HWRENDER if (rendermode != render_soft && rendermode != render_none) @@ -940,133 +942,52 @@ void V_DrawFadeScreen(void) } #endif - w = vid.width>>2; - for (y = 0; y < vid.height; y++) - { - buf = (INT32 *)(void *)(screens[0] + vid.width*y); - for (x = 0; x < w; x++) - { - if (buf+ x > (const INT32 *)(const void *)deststop) - return; - M_Memcpy(&quad,buf+x,sizeof (quad)); //quad = buf[x]; - p1 = fadetable[quad&255]; - p2 = fadetable[(quad>>8)&255]; - p3 = fadetable[(quad>>16)&255]; - p4 = fadetable[quad>>24]; - quad = (p4<<24) | (p3<<16) | (p2<<8) | p1;//buf[x] = (p4<<24) | (p3<<16) | (p2<<8) | p1; - M_Memcpy(buf+x,&quad,sizeof (quad)); - } - } + // heavily simplified -- we don't need to know x or y + // position when we're doing a full screen fade + for (; buf < deststop; ++buf) + *buf = fadetable[*buf]; } -// Simple translucency with one color. Coords are resolution dependent. -// -void V_DrawFadeConsBack(INT32 px1, INT32 py1, INT32 px2, INT32 py2, INT32 color) +// Simple translucency with one color, over a set number of lines starting from the top. +void V_DrawFadeConsBack(INT32 plines, INT32 pcolor) { - INT32 x, y, w; - INT32 *buf; - UINT32 quad; - UINT8 p1, p2, p3, p4; - INT16 *wput; - const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height; - UINT8 *colormap; + UINT8 *deststop, *colormap, *buf; #ifdef HWRENDER // not win32 only 19990829 by Kin if (rendermode != render_soft && rendermode != render_none) { UINT32 hwcolor; - - switch (color) + switch (pcolor) { - case 0: // white - hwcolor = 0xffffff00; - break; - case 1: // orange - hwcolor = 0xff800000; - break; - case 2: // blue - hwcolor = 0x0000ff00; - break; - case 3: // green - hwcolor = 0x00800000; - break; - case 4: // gray - hwcolor = 0x80808000; - break; - case 5: // red - hwcolor = 0xff000000; - break; - default: - hwcolor = 0x00800000; - break; + case 0: hwcolor = 0xffffff00; break; //white + case 1: hwcolor = 0xff800000; break; //orange + case 2: hwcolor = 0x0000ff00; break; //blue + case 3: hwcolor = 0x00800000; break; //green + case 4: hwcolor = 0x80808000; break; //gray + case 5: hwcolor = 0xff000000; break; //red + default: hwcolor = 0x00800000; break; //green } - - HWR_DrawConsoleBack(hwcolor, py2); + HWR_DrawConsoleBack(hwcolor, plines); return; } #endif - switch (color) + switch (pcolor) { - case 0: - colormap = cwhitemap; - break; - case 1: - colormap = corangemap; - break; - case 2: - colormap = cbluemap; - break; - case 3: - colormap = cgreenmap; - break; - case 4: - colormap = cgraymap; - break; - case 5: - colormap = credmap; - break; - default: - colormap = cgreenmap; - break; + case 0: colormap = cwhitemap; break; + case 1: colormap = corangemap; break; + case 2: colormap = cbluemap; break; + case 3: colormap = cgreenmap; break; + case 4: colormap = cgraymap; break; + case 5: colormap = credmap; break; + default: colormap = cgreenmap; break; } - if (scr_bpp == 1) - { - px1 >>=2; - px2 >>=2; - for (y = py1; y < py2; y++) - { - buf = (INT32 *)(void *)(screens[0] + vid.width*y); - for (x = px1; x < px2; x++) - { - if (&buf[x] > (const INT32 *)(const void *)deststop) - return; - M_Memcpy(&quad,buf+x,sizeof (quad)); //quad = buf[x]; - p1 = colormap[quad&255]; - p2 = colormap[(quad>>8)&255]; - p3 = colormap[(quad>>16)&255]; - p4 = colormap[quad>>24]; - quad = (p4<<24) | (p3<<16) | (p2<<8) | p1;//buf[x] = (p4<<24) | (p3<<16) | (p2<<8) | p1; - M_Memcpy(buf+x, &quad, sizeof (quad)); - } - } - } - else - { - w = px2 - px1; - for (y = py1; y < py2; y++) - { - wput = (INT16 *)(void *)(screens[0] + vid.width*y) + px1; - for (x = 0; x < w; x++) - { - if (wput > (const INT16 *)(const void *)deststop) - return; - *wput = (INT16)(((*wput&0x7bde) + (15<<5)) >>1); - wput++; - } - } - } + // heavily simplified -- we don't need to know x or y position, + // just the stop position + deststop = screens[0] + vid.rowbytes * min(plines, vid.height); + for (buf = screens[0]; buf < deststop; ++buf) + *buf = colormap[*buf]; } // Gets string colormap, used for 0x80 color codes @@ -1392,6 +1313,12 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string) } } +void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *string) +{ + x -= V_SmallStringWidth(string, option); + V_DrawSmallString(x, y, option, string); +} + // // Write a string using the tny_font // NOTE: the text is centered for screens larger than the base width @@ -1824,6 +1751,44 @@ INT32 V_StringWidth(const char *string, INT32 option) return w; } +// +// Find string width from hu_font chars, 0.5x scale +// +INT32 V_SmallStringWidth(const char *string, INT32 option) +{ + INT32 c, w = 0; + INT32 spacewidth = 2, charwidth = 0; + size_t i; + + switch (option & V_SPACINGMASK) + { + case V_MONOSPACE: + spacewidth = 4; + case V_OLDSPACING: + charwidth = 4; + break; + case V_6WIDTHSPACE: + spacewidth = 3; + default: + break; + } + + for (i = 0; i < strlen(string); i++) + { + c = string[i]; + if ((UINT8)c >= 0x80 && (UINT8)c <= 0x89) //color parsing! -Inuyasha 2.16.09 + continue; + + c = toupper(c) - HU_FONTSTART; + if (c < 0 || c >= HU_FONTSIZE || !hu_font[c]) + w += spacewidth; + else + w += (charwidth ? charwidth : SHORT(hu_font[c]->width)/2); + } + + return w; +} + // // Find string width from tny_font chars // @@ -1903,61 +1868,61 @@ void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param) if (type == postimg_water) { - UINT8 *tmpscr = screens[4]; - UINT8 *srcscr = screens[0]; - INT32 y; - angle_t disStart = (leveltime * 128) & FINEMASK; // in 0 to FINEANGLE - INT32 newpix; - INT32 sine; - //UINT8 *transme = ((tr_trans50)<>FRACBITS; + newpix = abs(sine); + + if (sine < 0) { - sine = (FINESINE(disStart)*5)>>FRACBITS; - newpix = abs(sine); + M_Memcpy(&tmpscr[y*vid.width+newpix], &srcscr[y*vid.width], vid.width-newpix); - if (sine < 0) + // Cleanup edge + while (newpix) { - M_Memcpy(&tmpscr[y*vid.width+newpix], &srcscr[y*vid.width], vid.width-newpix); - - // Cleanup edge - while (newpix) - { - tmpscr[y*vid.width+newpix] = srcscr[y*vid.width]; - newpix--; - } + tmpscr[y*vid.width+newpix] = srcscr[y*vid.width]; + newpix--; } - else + } + else + { + M_Memcpy(&tmpscr[y*vid.width+0], &srcscr[y*vid.width+sine], vid.width-newpix); + + // Cleanup edge + while (newpix) { - M_Memcpy(&tmpscr[y*vid.width+0], &srcscr[y*vid.width+sine], vid.width-newpix); - - // Cleanup edge - while (newpix) - { - tmpscr[y*vid.width+vid.width-newpix] = srcscr[y*vid.width+(vid.width-1)]; - newpix--; - } + tmpscr[y*vid.width+vid.width-newpix] = srcscr[y*vid.width+(vid.width-1)]; + newpix--; } + } /* Unoptimized version - for (x = 0; x < vid.width*vid.bpp; x++) - { - newpix = (x + sine); + for (x = 0; x < vid.width*vid.bpp; x++) + { + newpix = (x + sine); - if (newpix < 0) - newpix = 0; - else if (newpix >= vid.width) - newpix = vid.width-1; + if (newpix < 0) + newpix = 0; + else if (newpix >= vid.width) + newpix = vid.width-1; - tmpscr[y*vid.width + x] = srcscr[y*vid.width+newpix]; // *(transme + (srcscr[y*vid.width+x]<<8) + srcscr[y*vid.width+newpix]); - }*/ - disStart += 22;//the offset into the displacement map, increment each game loop - disStart &= FINEMASK; //clip it to FINEMASK - } + tmpscr[y*vid.width + x] = srcscr[y*vid.width+newpix]; // *(transme + (srcscr[y*vid.width+x]<<8) + srcscr[y*vid.width+newpix]); + }*/ + disStart += 22;//the offset into the displacement map, increment each game loop + disStart &= FINEMASK; //clip it to FINEMASK + } - VID_BlitLinearScreen(tmpscr+vid.width*vid.bpp*yoffset, screens[0]+vid.width*vid.bpp*yoffset, - vid.width*vid.bpp, height, vid.width*vid.bpp, vid.width); + VID_BlitLinearScreen(tmpscr+vid.width*vid.bpp*yoffset, screens[0]+vid.width*vid.bpp*yoffset, + vid.width*vid.bpp, height, vid.width*vid.bpp, vid.width); } else if (type == postimg_motion) // Motion Blur! { diff --git a/src/v_video.h b/src/v_video.h index 4e08e7004..85dbc3884 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -145,7 +145,7 @@ void V_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatnum); // fade down the screen buffer before drawing the menu over void V_DrawFadeScreen(void); -void V_DrawFadeConsBack(INT32 px1, INT32 py1, INT32 px2, INT32 py2, INT32 pcolor); +void V_DrawFadeConsBack(INT32 plines, INT32 pcolor); // draw a single character void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed); @@ -160,8 +160,11 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string); void V_DrawCenteredString(INT32 x, INT32 y, INT32 option, const char *string); void V_DrawRightAlignedString(INT32 x, INT32 y, INT32 option, const char *string); +// draw a string using the hu_font, 0.5x scale void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string); +void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *string); +// draw a string using the tny_font void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string); void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *string); @@ -180,6 +183,8 @@ INT32 V_CreditStringWidth(const char *string); // Find string width from hu_font chars INT32 V_StringWidth(const char *string, INT32 option); +// Find string width from hu_font chars, 0.5x scale +INT32 V_SmallStringWidth(const char *string, INT32 option); // Find string width from tny_font chars INT32 V_ThinStringWidth(const char *string, INT32 option); diff --git a/src/win32/Makefile.cfg b/src/win32/Makefile.cfg index 2ebde6b23..b989923fe 100644 --- a/src/win32/Makefile.cfg +++ b/src/win32/Makefile.cfg @@ -53,13 +53,12 @@ endif # name of the exefile ifdef SDL - EXENAME?=srb2sdl.exe + EXENAME?=srb2sdl2.exe else EXENAME?=srb2win.exe endif ifdef SDL - D_FILES+=$(D_DIR)/fmod.dll i_system_o+=$(OBJDIR)/SRB2.res i_main_o+=$(OBJDIR)/win_dbg.o ifndef NOHW