C6_ACT4.C 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. /* Catacomb Apocalypse Source Code
  2. * Copyright (C) 1993-2014 Flat Rock Software
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along
  15. * with this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  17. */
  18. // C4_PLAY.C
  19. #include "DEF.H"
  20. #pragma hdrstop
  21. /*
  22. =============================================================================
  23. LOCAL CONSTANTS
  24. =============================================================================
  25. */
  26. //-------------------------------------------------------------------------
  27. //
  28. // MISC OBJECTS
  29. //
  30. //-------------------------------------------------------------------------
  31. //-------------------------------------------------------------------------
  32. // COLUMN, SULPHUR GAS HOLE, FIRE POT, FOUNTAIN
  33. //-------------------------------------------------------------------------
  34. void SpawnMiscObjects(int tilex, int tiley, int num);
  35. statetype s_column1 = {COLUMN1PIC, 20, NULL, &s_column1};
  36. statetype s_column2 = {COLUMN2PIC, 20, NULL, &s_column2};
  37. statetype s_column3 = {COLUMN3PIC, 20, NULL, &s_column3};
  38. statetype s_column4 = {COLUMN4PIC, 20, NULL, &s_column4};
  39. statetype s_column5 = {COLUMN5PIC, 20, NULL, &s_column5};
  40. statetype s_ffire_pot = {FFIRE_POTPIC, 20, NULL, &s_ffire_pot};
  41. statetype s_ofire_pot1 = {OFIRE_POT1PIC, 20, NULL, &s_ofire_pot2};
  42. statetype s_ofire_pot2 = {OFIRE_POT2PIC, 20, NULL, &s_ofire_pot1};
  43. statetype s_tomb1 = {TOMB1PIC, 20, NULL, &s_tomb1};
  44. statetype s_tomb2 = {TOMB2PIC, 20, NULL, &s_tomb2};
  45. void SpawnMiscObjects(int tilex, int tiley, int num)
  46. {
  47. statetype *objstate;
  48. switch (num)
  49. {
  50. case 1:
  51. objstate = &s_column1;
  52. break;
  53. case 2:
  54. objstate = &s_column2;
  55. break;
  56. case 3:
  57. objstate = &s_column3;
  58. break;
  59. case 4:
  60. objstate = &s_ffire_pot;
  61. break;
  62. case 5:
  63. objstate = &s_column4;
  64. break;
  65. case 6:
  66. objstate = &s_ofire_pot1;
  67. break;
  68. case 7:
  69. objstate = &s_tomb1;
  70. break;
  71. case 8:
  72. objstate = &s_tomb2;
  73. break;
  74. case 9:
  75. objstate = &s_column5;
  76. break;
  77. }
  78. SpawnNewObj(tilex, tiley, objstate, PIXRADIUS*10);
  79. new->obclass = realsolidobj;
  80. new->flags |= of_shootable;
  81. }
  82. //------------------------------------------------------------------------
  83. // FORCE FIELD
  84. //------------------------------------------------------------------------
  85. void SpawnForceField(int tilex, int tiley);
  86. void T_ForceField(objtype *ob);
  87. void T_ForceFieldRemove(objtype *ob);
  88. statetype s_force_field_1 = {FORCE_FIELD_1PIC, 10, T_ForceField, &s_force_field_2};
  89. statetype s_force_field_2 = {FORCE_FIELD_2PIC, 10, T_ForceField, &s_force_field_3};
  90. statetype s_force_field_3 = {FORCE_FIELD_3PIC, 10, T_ForceField, &s_force_field_4};
  91. statetype s_force_field_4 = {FORCE_FIELD_4PIC, 10, T_ForceField, &s_force_field_1};
  92. statetype s_force_field_die = {0,0,T_ForceFieldRemove,&s_force_field_die1};
  93. statetype s_force_field_die1 = {0,0,NULL,NULL};
  94. void SpawnForceField(int tilex, int tiley)
  95. {
  96. SpawnNewObj(tilex,tiley,&s_force_field_1,PIXRADIUS*35);
  97. new->obclass = solidobj;
  98. new->hitpoints = EasyHitPoints(20);
  99. new->temp1 = 0;
  100. new->flags |= of_forcefield; //sets bit 7 :: makes it nonsolid, but also detectable
  101. // without adding another object type!
  102. new->flags |= of_shootable;
  103. }
  104. void T_ForceField(objtype *ob)
  105. {
  106. long move,deltax,deltay,size;
  107. size = (long)ob->size + player->size;
  108. deltax = ob->x - player->x;
  109. deltay = ob->y - player->y;
  110. if (deltax <= size && deltax >= -size
  111. && deltay <= size && deltay >= -size)
  112. if (!new->temp1)
  113. {
  114. TakeDamage (94);
  115. new->temp1 = 1;
  116. return;
  117. }
  118. else
  119. return;
  120. new->temp1 = 0;
  121. }
  122. void T_ForceFieldRemove(objtype *ob)
  123. {
  124. actorat[ob->tilex][ob->tiley] = 0;
  125. }
  126. //-------------------------------------------------------------------------
  127. //
  128. // INVISIBLE WALL CONTROLLER
  129. //
  130. //-------------------------------------------------------------------------
  131. void SpawnInvisWallCntroller(int x, int y);
  132. void T_InvisWall(objtype *ob);
  133. extern statetype s_invis_wall_control;
  134. statetype s_invis_wall_control = {0, 10, T_InvisWall, &s_invis_wall_control};
  135. void SpawnInvisWallCntroller(int tilex, int tiley)
  136. {
  137. SpawnNewObj(tilex,tiley,&s_invis_wall_control,PIXRADIUS*35);
  138. new->obclass = solidobj;
  139. new->flags &= ~of_shootable;
  140. new->temp1 = tilemap[tilex][tiley]; // Number for the wall tile here
  141. // Used for replacing the wall tile
  142. }
  143. void T_InvisWall(objtype *ob)
  144. {
  145. long move,deltax,deltay,size;
  146. size = (long)ob->size + player->size;
  147. deltax = ob->x - player->x;
  148. deltay = ob->y - player->y;
  149. if ((deltax <= size && deltax >= -size
  150. && deltay <= size && deltay >= -size) ||
  151. (ob->tilex == player->tilex) && (ob->tiley == player->tiley))
  152. {
  153. // Get rid of the wall tile if you are on it
  154. tilemap[ob->tilex][ob->tiley] = 0;
  155. }
  156. else
  157. {
  158. // Replace wall tile
  159. tilemap[ob->tilex][ob->tiley] = ob->temp1;
  160. }
  161. }
  162. /////////////////////////////////////////////////////////////////////////////
  163. //
  164. // EasyHitPoints
  165. //
  166. // Checks to see if the player has selected the easy mode for playing.
  167. // If so then the normal hit points are cut in half.
  168. // This is when the object is spawned.
  169. //
  170. // Parms
  171. // NrmHitPts - the normal hit points
  172. //
  173. // Returns
  174. // Half of NrmHitPts
  175. //
  176. /////////////////////////////////////////////////////////////////////////////
  177. int EasyHitPoints(int NrmHitPts)
  178. {
  179. if (EASYMODEON) // Wimpy, Wimpy, Wimpy!!!!!
  180. {
  181. return(NrmHitPts/4);
  182. }
  183. else
  184. return(NrmHitPts);
  185. }
  186. /////////////////////////////////////////////////////////////////////////////
  187. //
  188. // EasyDoDamage
  189. //
  190. // Checks to see if the player has selected the easy mode for playing.
  191. // If so then the normal amount of damage is cut in half.
  192. // This is called each time a monster does damage.
  193. //
  194. // Parms
  195. // Damage - the normal damage taken
  196. //
  197. // Returns
  198. // Half of Damage
  199. //
  200. /////////////////////////////////////////////////////////////////////////////
  201. int EasyDoDamage(int Damage)
  202. {
  203. if (EASYMODEON) // Wimpy, Wimpy, Wimpy!!!!!
  204. return(Damage/2);
  205. else
  206. return(Damage);
  207. }