wolf_renderer.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. Copyright (C) 2004-2005 Michael Liebscher <johnnycanuck@users.sourceforge.net>
  3. Copyright (C) 1997-2001 Id Software, Inc.
  4. This program is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU General Public License
  6. as published by the Free Software Foundation; either version 2
  7. of the License, or (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  15. */
  16. /*
  17. * wolf_renderer.c: Wolfenstein 3-D renderer.
  18. *
  19. * Author: Michael Liebscher <johnnycanuck@users.sourceforge.net>
  20. *
  21. * Acknowledgement:
  22. * Portion of this code was derived from Quake II, and was originally
  23. * written by Id Software, Inc.
  24. *
  25. */
  26. #include "../wolfiphone.h"
  27. LevelData_t *r_world;
  28. /*
  29. -----------------------------------------------------------------------------
  30. Function: R_BeginRegistration -Start the rendering registration sequence.
  31. Parameters: map -[in] The name of the map to load.
  32. Returns: Nothing.
  33. Notes:
  34. -----------------------------------------------------------------------------
  35. */
  36. PUBLIC void R_BeginRegistration( const char *map )
  37. {
  38. char fullname[ MAX_GAMEPATH ];
  39. if( ! map || ! *map )
  40. {
  41. return;
  42. }
  43. ++texture_registration_sequence;
  44. //my_snprintf( fullname, sizeof( fullname ), "maps/%s.map", map );
  45. if ( g_version->value == SPEAROFDESTINY && currentMap.episode >= 6 && currentMap.episode < 10) //add if/else... gsh
  46. my_snprintf( fullname, sizeof( fullname ), "%s.map", map );
  47. else if (currentMap.episode >= 10)
  48. my_snprintf( fullname, sizeof( fullname ), "%s.map", map );
  49. else
  50. my_snprintf( fullname, sizeof( fullname ), "maps/%s.map", map );
  51. // Door_ResetDoors( &r_world->Doors );
  52. Powerup_Reset();
  53. Sprite_Reset();
  54. Areas_InitAreas( Player.areanumber );
  55. PushWall_Reset();
  56. memset( &levelstate, 0, sizeof( levelstate ) ); // Reset gamestate
  57. ResetGuards();
  58. r_world = Level_LoadMap( fullname );
  59. if( r_world == NULL )
  60. {
  61. Com_Printf( "Could not load map (%s) in R_BeginRegistration\n", map );
  62. return;
  63. }
  64. levelstate.floornum = floornumber;
  65. if( g_version->value == SPEAROFDESTINY && currentMap.episode >= 6 && currentMap.episode < 9) //added the episode check... gsh)
  66. {
  67. if( strlen( map ) >= 2 )
  68. {
  69. levelstate.floornum = atoi( map+1 );
  70. if( levelstate.floornum == 20 )
  71. {
  72. levelstate.floornum = 17;
  73. }
  74. }
  75. }
  76. }