st_stuff.c 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472
  1. // Emacs style mode select -*- C++ -*-
  2. //-----------------------------------------------------------------------------
  3. //
  4. // $Id:$
  5. //
  6. // Copyright (C) 1993-1996 by id Software, Inc.
  7. //
  8. // This source is available for distribution and/or modification
  9. // only under the terms of the DOOM Source Code License as
  10. // published by id Software. All rights reserved.
  11. //
  12. // The source is distributed in the hope that it will be useful,
  13. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
  15. // for more details.
  16. //
  17. // $Log:$
  18. //
  19. // DESCRIPTION:
  20. // Status bar code.
  21. // Does the face/direction indicator animatin.
  22. // Does palette indicators as well (red pain/berserk, bright pickup)
  23. //
  24. //-----------------------------------------------------------------------------
  25. static const char
  26. rcsid[] = "$Id: st_stuff.c,v 1.6 1997/02/03 22:45:13 b1 Exp $";
  27. #include <stdio.h>
  28. #include "i_system.h"
  29. #include "i_video.h"
  30. #include "z_zone.h"
  31. #include "m_random.h"
  32. #include "w_wad.h"
  33. #include "doomdef.h"
  34. #include "g_game.h"
  35. #include "st_stuff.h"
  36. #include "st_lib.h"
  37. #include "r_local.h"
  38. #include "p_local.h"
  39. #include "p_inter.h"
  40. #include "am_map.h"
  41. #include "m_cheat.h"
  42. #include "s_sound.h"
  43. // Needs access to LFB.
  44. #include "v_video.h"
  45. // State.
  46. #include "doomstat.h"
  47. // Data.
  48. #include "dstrings.h"
  49. #include "sounds.h"
  50. //
  51. // STATUS BAR DATA
  52. //
  53. // Palette indices.
  54. // For damage/bonus red-/gold-shifts
  55. #define STARTREDPALS 1
  56. #define STARTBONUSPALS 9
  57. #define NUMREDPALS 8
  58. #define NUMBONUSPALS 4
  59. // Radiation suit, green shift.
  60. #define RADIATIONPAL 13
  61. // N/256*100% probability
  62. // that the normal face state will change
  63. #define ST_FACEPROBABILITY 96
  64. // For Responder
  65. #define ST_TOGGLECHAT KEY_ENTER
  66. // Location of status bar
  67. #define ST_X 0
  68. #define ST_X2 104
  69. #define ST_FX 143
  70. #define ST_FY 169
  71. // Should be set to patch width
  72. // for tall numbers later on
  73. #define ST_TALLNUMWIDTH (tallnum[0]->width)
  74. // Number of status faces.
  75. #define ST_NUMPAINFACES 5
  76. #define ST_NUMSTRAIGHTFACES 3
  77. #define ST_NUMTURNFACES 2
  78. #define ST_NUMSPECIALFACES 3
  79. #define ST_FACESTRIDE \
  80. (ST_NUMSTRAIGHTFACES+ST_NUMTURNFACES+ST_NUMSPECIALFACES)
  81. #define ST_NUMEXTRAFACES 2
  82. #define ST_NUMFACES \
  83. (ST_FACESTRIDE*ST_NUMPAINFACES+ST_NUMEXTRAFACES)
  84. #define ST_TURNOFFSET (ST_NUMSTRAIGHTFACES)
  85. #define ST_OUCHOFFSET (ST_TURNOFFSET + ST_NUMTURNFACES)
  86. #define ST_EVILGRINOFFSET (ST_OUCHOFFSET + 1)
  87. #define ST_RAMPAGEOFFSET (ST_EVILGRINOFFSET + 1)
  88. #define ST_GODFACE (ST_NUMPAINFACES*ST_FACESTRIDE)
  89. #define ST_DEADFACE (ST_GODFACE+1)
  90. #define ST_FACESX 143
  91. #define ST_FACESY 168
  92. #define ST_EVILGRINCOUNT (2*TICRATE)
  93. #define ST_STRAIGHTFACECOUNT (TICRATE/2)
  94. #define ST_TURNCOUNT (1*TICRATE)
  95. #define ST_OUCHCOUNT (1*TICRATE)
  96. #define ST_RAMPAGEDELAY (2*TICRATE)
  97. #define ST_MUCHPAIN 20
  98. // Location and size of statistics,
  99. // justified according to widget type.
  100. // Problem is, within which space? STbar? Screen?
  101. // Note: this could be read in by a lump.
  102. // Problem is, is the stuff rendered
  103. // into a buffer,
  104. // or into the frame buffer?
  105. // AMMO number pos.
  106. #define ST_AMMOWIDTH 3
  107. #define ST_AMMOX 44
  108. #define ST_AMMOY 171
  109. // HEALTH number pos.
  110. #define ST_HEALTHWIDTH 3
  111. #define ST_HEALTHX 90
  112. #define ST_HEALTHY 171
  113. // Weapon pos.
  114. #define ST_ARMSX 111
  115. #define ST_ARMSY 172
  116. #define ST_ARMSBGX 104
  117. #define ST_ARMSBGY 168
  118. #define ST_ARMSXSPACE 12
  119. #define ST_ARMSYSPACE 10
  120. // Frags pos.
  121. #define ST_FRAGSX 138
  122. #define ST_FRAGSY 171
  123. #define ST_FRAGSWIDTH 2
  124. // ARMOR number pos.
  125. #define ST_ARMORWIDTH 3
  126. #define ST_ARMORX 221
  127. #define ST_ARMORY 171
  128. // Key icon positions.
  129. #define ST_KEY0WIDTH 8
  130. #define ST_KEY0HEIGHT 5
  131. #define ST_KEY0X 239
  132. #define ST_KEY0Y 171
  133. #define ST_KEY1WIDTH ST_KEY0WIDTH
  134. #define ST_KEY1X 239
  135. #define ST_KEY1Y 181
  136. #define ST_KEY2WIDTH ST_KEY0WIDTH
  137. #define ST_KEY2X 239
  138. #define ST_KEY2Y 191
  139. // Ammunition counter.
  140. #define ST_AMMO0WIDTH 3
  141. #define ST_AMMO0HEIGHT 6
  142. #define ST_AMMO0X 288
  143. #define ST_AMMO0Y 173
  144. #define ST_AMMO1WIDTH ST_AMMO0WIDTH
  145. #define ST_AMMO1X 288
  146. #define ST_AMMO1Y 179
  147. #define ST_AMMO2WIDTH ST_AMMO0WIDTH
  148. #define ST_AMMO2X 288
  149. #define ST_AMMO2Y 191
  150. #define ST_AMMO3WIDTH ST_AMMO0WIDTH
  151. #define ST_AMMO3X 288
  152. #define ST_AMMO3Y 185
  153. // Indicate maximum ammunition.
  154. // Only needed because backpack exists.
  155. #define ST_MAXAMMO0WIDTH 3
  156. #define ST_MAXAMMO0HEIGHT 5
  157. #define ST_MAXAMMO0X 314
  158. #define ST_MAXAMMO0Y 173
  159. #define ST_MAXAMMO1WIDTH ST_MAXAMMO0WIDTH
  160. #define ST_MAXAMMO1X 314
  161. #define ST_MAXAMMO1Y 179
  162. #define ST_MAXAMMO2WIDTH ST_MAXAMMO0WIDTH
  163. #define ST_MAXAMMO2X 314
  164. #define ST_MAXAMMO2Y 191
  165. #define ST_MAXAMMO3WIDTH ST_MAXAMMO0WIDTH
  166. #define ST_MAXAMMO3X 314
  167. #define ST_MAXAMMO3Y 185
  168. // pistol
  169. #define ST_WEAPON0X 110
  170. #define ST_WEAPON0Y 172
  171. // shotgun
  172. #define ST_WEAPON1X 122
  173. #define ST_WEAPON1Y 172
  174. // chain gun
  175. #define ST_WEAPON2X 134
  176. #define ST_WEAPON2Y 172
  177. // missile launcher
  178. #define ST_WEAPON3X 110
  179. #define ST_WEAPON3Y 181
  180. // plasma gun
  181. #define ST_WEAPON4X 122
  182. #define ST_WEAPON4Y 181
  183. // bfg
  184. #define ST_WEAPON5X 134
  185. #define ST_WEAPON5Y 181
  186. // WPNS title
  187. #define ST_WPNSX 109
  188. #define ST_WPNSY 191
  189. // DETH title
  190. #define ST_DETHX 109
  191. #define ST_DETHY 191
  192. //Incoming messages window location
  193. //UNUSED
  194. // #define ST_MSGTEXTX (viewwindowx)
  195. // #define ST_MSGTEXTY (viewwindowy+viewheight-18)
  196. #define ST_MSGTEXTX 0
  197. #define ST_MSGTEXTY 0
  198. // Dimensions given in characters.
  199. #define ST_MSGWIDTH 52
  200. // Or shall I say, in lines?
  201. #define ST_MSGHEIGHT 1
  202. #define ST_OUTTEXTX 0
  203. #define ST_OUTTEXTY 6
  204. // Width, in characters again.
  205. #define ST_OUTWIDTH 52
  206. // Height, in lines.
  207. #define ST_OUTHEIGHT 1
  208. #define ST_MAPWIDTH \
  209. (strlen(mapnames[(gameepisode-1)*9+(gamemap-1)]))
  210. #define ST_MAPTITLEX \
  211. (SCREENWIDTH - ST_MAPWIDTH * ST_CHATFONTWIDTH)
  212. #define ST_MAPTITLEY 0
  213. #define ST_MAPHEIGHT 1
  214. // main player in game
  215. static player_t* plyr;
  216. // ST_Start() has just been called
  217. static boolean st_firsttime;
  218. // used to execute ST_Init() only once
  219. static int veryfirsttime = 1;
  220. // lump number for PLAYPAL
  221. static int lu_palette;
  222. // used for timing
  223. static unsigned int st_clock;
  224. // used for making messages go away
  225. static int st_msgcounter=0;
  226. // used when in chat
  227. static st_chatstateenum_t st_chatstate;
  228. // whether in automap or first-person
  229. static st_stateenum_t st_gamestate;
  230. // whether left-side main status bar is active
  231. static boolean st_statusbaron;
  232. // whether status bar chat is active
  233. static boolean st_chat;
  234. // value of st_chat before message popped up
  235. static boolean st_oldchat;
  236. // whether chat window has the cursor on
  237. static boolean st_cursoron;
  238. // !deathmatch
  239. static boolean st_notdeathmatch;
  240. // !deathmatch && st_statusbaron
  241. static boolean st_armson;
  242. // !deathmatch
  243. static boolean st_fragson;
  244. // main bar left
  245. static patch_t* sbar;
  246. // 0-9, tall numbers
  247. static patch_t* tallnum[10];
  248. // tall % sign
  249. static patch_t* tallpercent;
  250. // 0-9, short, yellow (,different!) numbers
  251. static patch_t* shortnum[10];
  252. // 3 key-cards, 3 skulls
  253. static patch_t* keys[NUMCARDS];
  254. // face status patches
  255. static patch_t* faces[ST_NUMFACES];
  256. // face background
  257. static patch_t* faceback;
  258. // main bar right
  259. static patch_t* armsbg;
  260. // weapon ownership patches
  261. static patch_t* arms[6][2];
  262. // ready-weapon widget
  263. static st_number_t w_ready;
  264. // in deathmatch only, summary of frags stats
  265. static st_number_t w_frags;
  266. // health widget
  267. static st_percent_t w_health;
  268. // arms background
  269. static st_binicon_t w_armsbg;
  270. // weapon ownership widgets
  271. static st_multicon_t w_arms[6];
  272. // face status widget
  273. static st_multicon_t w_faces;
  274. // keycard widgets
  275. static st_multicon_t w_keyboxes[3];
  276. // armor widget
  277. static st_percent_t w_armor;
  278. // ammo widgets
  279. static st_number_t w_ammo[4];
  280. // max ammo widgets
  281. static st_number_t w_maxammo[4];
  282. // number of frags so far in deathmatch
  283. static int st_fragscount;
  284. // used to use appopriately pained face
  285. static int st_oldhealth = -1;
  286. // used for evil grin
  287. static boolean oldweaponsowned[NUMWEAPONS];
  288. // count until face changes
  289. static int st_facecount = 0;
  290. // current face index, used by w_faces
  291. static int st_faceindex = 0;
  292. // holds key-type for each key box on bar
  293. static int keyboxes[3];
  294. // a random number per tick
  295. static int st_randomnumber;
  296. // Massive bunches of cheat shit
  297. // to keep it from being easy to figure them out.
  298. // Yeah, right...
  299. unsigned char cheat_mus_seq[] =
  300. {
  301. 0xb2, 0x26, 0xb6, 0xae, 0xea, 1, 0, 0, 0xff
  302. };
  303. unsigned char cheat_choppers_seq[] =
  304. {
  305. 0xb2, 0x26, 0xe2, 0x32, 0xf6, 0x2a, 0x2a, 0xa6, 0x6a, 0xea, 0xff // id...
  306. };
  307. unsigned char cheat_god_seq[] =
  308. {
  309. 0xb2, 0x26, 0x26, 0xaa, 0x26, 0xff // iddqd
  310. };
  311. unsigned char cheat_ammo_seq[] =
  312. {
  313. 0xb2, 0x26, 0xf2, 0x66, 0xa2, 0xff // idkfa
  314. };
  315. unsigned char cheat_ammonokey_seq[] =
  316. {
  317. 0xb2, 0x26, 0x66, 0xa2, 0xff // idfa
  318. };
  319. // Smashing Pumpkins Into Samml Piles Of Putried Debris.
  320. unsigned char cheat_noclip_seq[] =
  321. {
  322. 0xb2, 0x26, 0xea, 0x2a, 0xb2, // idspispopd
  323. 0xea, 0x2a, 0xf6, 0x2a, 0x26, 0xff
  324. };
  325. //
  326. unsigned char cheat_commercial_noclip_seq[] =
  327. {
  328. 0xb2, 0x26, 0xe2, 0x36, 0xb2, 0x2a, 0xff // idclip
  329. };
  330. unsigned char cheat_powerup_seq[7][10] =
  331. {
  332. { 0xb2, 0x26, 0x62, 0xa6, 0x32, 0xf6, 0x36, 0x26, 0x6e, 0xff }, // beholdv
  333. { 0xb2, 0x26, 0x62, 0xa6, 0x32, 0xf6, 0x36, 0x26, 0xea, 0xff }, // beholds
  334. { 0xb2, 0x26, 0x62, 0xa6, 0x32, 0xf6, 0x36, 0x26, 0xb2, 0xff }, // beholdi
  335. { 0xb2, 0x26, 0x62, 0xa6, 0x32, 0xf6, 0x36, 0x26, 0x6a, 0xff }, // beholdr
  336. { 0xb2, 0x26, 0x62, 0xa6, 0x32, 0xf6, 0x36, 0x26, 0xa2, 0xff }, // beholda
  337. { 0xb2, 0x26, 0x62, 0xa6, 0x32, 0xf6, 0x36, 0x26, 0x36, 0xff }, // beholdl
  338. { 0xb2, 0x26, 0x62, 0xa6, 0x32, 0xf6, 0x36, 0x26, 0xff } // behold
  339. };
  340. unsigned char cheat_clev_seq[] =
  341. {
  342. 0xb2, 0x26, 0xe2, 0x36, 0xa6, 0x6e, 1, 0, 0, 0xff // idclev
  343. };
  344. // my position cheat
  345. unsigned char cheat_mypos_seq[] =
  346. {
  347. 0xb2, 0x26, 0xb6, 0xba, 0x2a, 0xf6, 0xea, 0xff // idmypos
  348. };
  349. // Now what?
  350. cheatseq_t cheat_mus = { cheat_mus_seq, 0 };
  351. cheatseq_t cheat_god = { cheat_god_seq, 0 };
  352. cheatseq_t cheat_ammo = { cheat_ammo_seq, 0 };
  353. cheatseq_t cheat_ammonokey = { cheat_ammonokey_seq, 0 };
  354. cheatseq_t cheat_noclip = { cheat_noclip_seq, 0 };
  355. cheatseq_t cheat_commercial_noclip = { cheat_commercial_noclip_seq, 0 };
  356. cheatseq_t cheat_powerup[7] =
  357. {
  358. { cheat_powerup_seq[0], 0 },
  359. { cheat_powerup_seq[1], 0 },
  360. { cheat_powerup_seq[2], 0 },
  361. { cheat_powerup_seq[3], 0 },
  362. { cheat_powerup_seq[4], 0 },
  363. { cheat_powerup_seq[5], 0 },
  364. { cheat_powerup_seq[6], 0 }
  365. };
  366. cheatseq_t cheat_choppers = { cheat_choppers_seq, 0 };
  367. cheatseq_t cheat_clev = { cheat_clev_seq, 0 };
  368. cheatseq_t cheat_mypos = { cheat_mypos_seq, 0 };
  369. //
  370. extern char* mapnames[];
  371. //
  372. // STATUS BAR CODE
  373. //
  374. void ST_Stop(void);
  375. void ST_refreshBackground(void)
  376. {
  377. if (st_statusbaron)
  378. {
  379. V_DrawPatch(ST_X, 0, BG, sbar);
  380. if (netgame)
  381. V_DrawPatch(ST_FX, 0, BG, faceback);
  382. V_CopyRect(ST_X, 0, BG, ST_WIDTH, ST_HEIGHT, ST_X, ST_Y, FG);
  383. }
  384. }
  385. // Respond to keyboard input events,
  386. // intercept cheats.
  387. boolean
  388. ST_Responder (event_t* ev)
  389. {
  390. int i;
  391. // Filter automap on/off.
  392. if (ev->type == ev_keyup
  393. && ((ev->data1 & 0xffff0000) == AM_MSGHEADER))
  394. {
  395. switch(ev->data1)
  396. {
  397. case AM_MSGENTERED:
  398. st_gamestate = AutomapState;
  399. st_firsttime = true;
  400. break;
  401. case AM_MSGEXITED:
  402. // fprintf(stderr, "AM exited\n");
  403. st_gamestate = FirstPersonState;
  404. break;
  405. }
  406. }
  407. // if a user keypress...
  408. else if (ev->type == ev_keydown)
  409. {
  410. if (!netgame)
  411. {
  412. // b. - enabled for more debug fun.
  413. // if (gameskill != sk_nightmare) {
  414. // 'dqd' cheat for toggleable god mode
  415. if (cht_CheckCheat(&cheat_god, ev->data1))
  416. {
  417. plyr->cheats ^= CF_GODMODE;
  418. if (plyr->cheats & CF_GODMODE)
  419. {
  420. if (plyr->mo)
  421. plyr->mo->health = 100;
  422. plyr->health = 100;
  423. plyr->message = STSTR_DQDON;
  424. }
  425. else
  426. plyr->message = STSTR_DQDOFF;
  427. }
  428. // 'fa' cheat for killer fucking arsenal
  429. else if (cht_CheckCheat(&cheat_ammonokey, ev->data1))
  430. {
  431. plyr->armorpoints = 200;
  432. plyr->armortype = 2;
  433. for (i=0;i<NUMWEAPONS;i++)
  434. plyr->weaponowned[i] = true;
  435. for (i=0;i<NUMAMMO;i++)
  436. plyr->ammo[i] = plyr->maxammo[i];
  437. plyr->message = STSTR_FAADDED;
  438. }
  439. // 'kfa' cheat for key full ammo
  440. else if (cht_CheckCheat(&cheat_ammo, ev->data1))
  441. {
  442. plyr->armorpoints = 200;
  443. plyr->armortype = 2;
  444. for (i=0;i<NUMWEAPONS;i++)
  445. plyr->weaponowned[i] = true;
  446. for (i=0;i<NUMAMMO;i++)
  447. plyr->ammo[i] = plyr->maxammo[i];
  448. for (i=0;i<NUMCARDS;i++)
  449. plyr->cards[i] = true;
  450. plyr->message = STSTR_KFAADDED;
  451. }
  452. // 'mus' cheat for changing music
  453. else if (cht_CheckCheat(&cheat_mus, ev->data1))
  454. {
  455. char buf[3];
  456. int musnum;
  457. plyr->message = STSTR_MUS;
  458. cht_GetParam(&cheat_mus, buf);
  459. if (gamemode == commercial)
  460. {
  461. musnum = mus_runnin + (buf[0]-'0')*10 + buf[1]-'0' - 1;
  462. if (((buf[0]-'0')*10 + buf[1]-'0') > 35)
  463. plyr->message = STSTR_NOMUS;
  464. else
  465. S_ChangeMusic(musnum, 1);
  466. }
  467. else
  468. {
  469. musnum = mus_e1m1 + (buf[0]-'1')*9 + (buf[1]-'1');
  470. if (((buf[0]-'1')*9 + buf[1]-'1') > 31)
  471. plyr->message = STSTR_NOMUS;
  472. else
  473. S_ChangeMusic(musnum, 1);
  474. }
  475. }
  476. // Simplified, accepting both "noclip" and "idspispopd".
  477. // no clipping mode cheat
  478. else if ( cht_CheckCheat(&cheat_noclip, ev->data1)
  479. || cht_CheckCheat(&cheat_commercial_noclip,ev->data1) )
  480. {
  481. plyr->cheats ^= CF_NOCLIP;
  482. if (plyr->cheats & CF_NOCLIP)
  483. plyr->message = STSTR_NCON;
  484. else
  485. plyr->message = STSTR_NCOFF;
  486. }
  487. // 'behold?' power-up cheats
  488. for (i=0;i<6;i++)
  489. {
  490. if (cht_CheckCheat(&cheat_powerup[i], ev->data1))
  491. {
  492. if (!plyr->powers[i])
  493. P_GivePower( plyr, i);
  494. else if (i!=pw_strength)
  495. plyr->powers[i] = 1;
  496. else
  497. plyr->powers[i] = 0;
  498. plyr->message = STSTR_BEHOLDX;
  499. }
  500. }
  501. // 'behold' power-up menu
  502. if (cht_CheckCheat(&cheat_powerup[6], ev->data1))
  503. {
  504. plyr->message = STSTR_BEHOLD;
  505. }
  506. // 'choppers' invulnerability & chainsaw
  507. else if (cht_CheckCheat(&cheat_choppers, ev->data1))
  508. {
  509. plyr->weaponowned[wp_chainsaw] = true;
  510. plyr->powers[pw_invulnerability] = true;
  511. plyr->message = STSTR_CHOPPERS;
  512. }
  513. // 'mypos' for player position
  514. else if (cht_CheckCheat(&cheat_mypos, ev->data1))
  515. {
  516. static char buf[ST_MSGWIDTH];
  517. sprintf(buf, "ang=0x%x;x,y=(0x%x,0x%x)",
  518. players[consoleplayer].mo->angle,
  519. players[consoleplayer].mo->x,
  520. players[consoleplayer].mo->y);
  521. plyr->message = buf;
  522. }
  523. }
  524. // 'clev' change-level cheat
  525. if (cht_CheckCheat(&cheat_clev, ev->data1))
  526. {
  527. char buf[3];
  528. int epsd;
  529. int map;
  530. cht_GetParam(&cheat_clev, buf);
  531. if (gamemode == commercial)
  532. {
  533. epsd = 0;
  534. map = (buf[0] - '0')*10 + buf[1] - '0';
  535. }
  536. else
  537. {
  538. epsd = buf[0] - '0';
  539. map = buf[1] - '0';
  540. }
  541. // Catch invalid maps.
  542. if (epsd < 1)
  543. return false;
  544. if (map < 1)
  545. return false;
  546. // Ohmygod - this is not going to work.
  547. if ((gamemode == retail)
  548. && ((epsd > 4) || (map > 9)))
  549. return false;
  550. if ((gamemode == registered)
  551. && ((epsd > 3) || (map > 9)))
  552. return false;
  553. if ((gamemode == shareware)
  554. && ((epsd > 1) || (map > 9)))
  555. return false;
  556. if ((gamemode == commercial)
  557. && (( epsd > 1) || (map > 34)))
  558. return false;
  559. // So be it.
  560. plyr->message = STSTR_CLEV;
  561. G_DeferedInitNew(gameskill, epsd, map);
  562. }
  563. }
  564. return false;
  565. }
  566. int ST_calcPainOffset(void)
  567. {
  568. int health;
  569. static int lastcalc;
  570. static int oldhealth = -1;
  571. health = plyr->health > 100 ? 100 : plyr->health;
  572. if (health != oldhealth)
  573. {
  574. lastcalc = ST_FACESTRIDE * (((100 - health) * ST_NUMPAINFACES) / 101);
  575. oldhealth = health;
  576. }
  577. return lastcalc;
  578. }
  579. //
  580. // This is a not-very-pretty routine which handles
  581. // the face states and their timing.
  582. // the precedence of expressions is:
  583. // dead > evil grin > turned head > straight ahead
  584. //
  585. void ST_updateFaceWidget(void)
  586. {
  587. int i;
  588. angle_t badguyangle;
  589. angle_t diffang;
  590. static int lastattackdown = -1;
  591. static int priority = 0;
  592. boolean doevilgrin;
  593. if (priority < 10)
  594. {
  595. // dead
  596. if (!plyr->health)
  597. {
  598. priority = 9;
  599. st_faceindex = ST_DEADFACE;
  600. st_facecount = 1;
  601. }
  602. }
  603. if (priority < 9)
  604. {
  605. if (plyr->bonuscount)
  606. {
  607. // picking up bonus
  608. doevilgrin = false;
  609. for (i=0;i<NUMWEAPONS;i++)
  610. {
  611. if (oldweaponsowned[i] != plyr->weaponowned[i])
  612. {
  613. doevilgrin = true;
  614. oldweaponsowned[i] = plyr->weaponowned[i];
  615. }
  616. }
  617. if (doevilgrin)
  618. {
  619. // evil grin if just picked up weapon
  620. priority = 8;
  621. st_facecount = ST_EVILGRINCOUNT;
  622. st_faceindex = ST_calcPainOffset() + ST_EVILGRINOFFSET;
  623. }
  624. }
  625. }
  626. if (priority < 8)
  627. {
  628. if (plyr->damagecount
  629. && plyr->attacker
  630. && plyr->attacker != plyr->mo)
  631. {
  632. // being attacked
  633. priority = 7;
  634. if (plyr->health - st_oldhealth > ST_MUCHPAIN)
  635. {
  636. st_facecount = ST_TURNCOUNT;
  637. st_faceindex = ST_calcPainOffset() + ST_OUCHOFFSET;
  638. }
  639. else
  640. {
  641. badguyangle = R_PointToAngle2(plyr->mo->x,
  642. plyr->mo->y,
  643. plyr->attacker->x,
  644. plyr->attacker->y);
  645. if (badguyangle > plyr->mo->angle)
  646. {
  647. // whether right or left
  648. diffang = badguyangle - plyr->mo->angle;
  649. i = diffang > ANG180;
  650. }
  651. else
  652. {
  653. // whether left or right
  654. diffang = plyr->mo->angle - badguyangle;
  655. i = diffang <= ANG180;
  656. } // confusing, aint it?
  657. st_facecount = ST_TURNCOUNT;
  658. st_faceindex = ST_calcPainOffset();
  659. if (diffang < ANG45)
  660. {
  661. // head-on
  662. st_faceindex += ST_RAMPAGEOFFSET;
  663. }
  664. else if (i)
  665. {
  666. // turn face right
  667. st_faceindex += ST_TURNOFFSET;
  668. }
  669. else
  670. {
  671. // turn face left
  672. st_faceindex += ST_TURNOFFSET+1;
  673. }
  674. }
  675. }
  676. }
  677. if (priority < 7)
  678. {
  679. // getting hurt because of your own damn stupidity
  680. if (plyr->damagecount)
  681. {
  682. if (plyr->health - st_oldhealth > ST_MUCHPAIN)
  683. {
  684. priority = 7;
  685. st_facecount = ST_TURNCOUNT;
  686. st_faceindex = ST_calcPainOffset() + ST_OUCHOFFSET;
  687. }
  688. else
  689. {
  690. priority = 6;
  691. st_facecount = ST_TURNCOUNT;
  692. st_faceindex = ST_calcPainOffset() + ST_RAMPAGEOFFSET;
  693. }
  694. }
  695. }
  696. if (priority < 6)
  697. {
  698. // rapid firing
  699. if (plyr->attackdown)
  700. {
  701. if (lastattackdown==-1)
  702. lastattackdown = ST_RAMPAGEDELAY;
  703. else if (!--lastattackdown)
  704. {
  705. priority = 5;
  706. st_faceindex = ST_calcPainOffset() + ST_RAMPAGEOFFSET;
  707. st_facecount = 1;
  708. lastattackdown = 1;
  709. }
  710. }
  711. else
  712. lastattackdown = -1;
  713. }
  714. if (priority < 5)
  715. {
  716. // invulnerability
  717. if ((plyr->cheats & CF_GODMODE)
  718. || plyr->powers[pw_invulnerability])
  719. {
  720. priority = 4;
  721. st_faceindex = ST_GODFACE;
  722. st_facecount = 1;
  723. }
  724. }
  725. // look left or look right if the facecount has timed out
  726. if (!st_facecount)
  727. {
  728. st_faceindex = ST_calcPainOffset() + (st_randomnumber % 3);
  729. st_facecount = ST_STRAIGHTFACECOUNT;
  730. priority = 0;
  731. }
  732. st_facecount--;
  733. }
  734. void ST_updateWidgets(void)
  735. {
  736. static int largeammo = 1994; // means "n/a"
  737. int i;
  738. // must redirect the pointer if the ready weapon has changed.
  739. // if (w_ready.data != plyr->readyweapon)
  740. // {
  741. if (weaponinfo[plyr->readyweapon].ammo == am_noammo)
  742. w_ready.num = &largeammo;
  743. else
  744. w_ready.num = &plyr->ammo[weaponinfo[plyr->readyweapon].ammo];
  745. //{
  746. // static int tic=0;
  747. // static int dir=-1;
  748. // if (!(tic&15))
  749. // plyr->ammo[weaponinfo[plyr->readyweapon].ammo]+=dir;
  750. // if (plyr->ammo[weaponinfo[plyr->readyweapon].ammo] == -100)
  751. // dir = 1;
  752. // tic++;
  753. // }
  754. w_ready.data = plyr->readyweapon;
  755. // if (*w_ready.on)
  756. // STlib_updateNum(&w_ready, true);
  757. // refresh weapon change
  758. // }
  759. // update keycard multiple widgets
  760. for (i=0;i<3;i++)
  761. {
  762. keyboxes[i] = plyr->cards[i] ? i : -1;
  763. if (plyr->cards[i+3])
  764. keyboxes[i] = i+3;
  765. }
  766. // refresh everything if this is him coming back to life
  767. ST_updateFaceWidget();
  768. // used by the w_armsbg widget
  769. st_notdeathmatch = !deathmatch;
  770. // used by w_arms[] widgets
  771. st_armson = st_statusbaron && !deathmatch;
  772. // used by w_frags widget
  773. st_fragson = deathmatch && st_statusbaron;
  774. st_fragscount = 0;
  775. for (i=0 ; i<MAXPLAYERS ; i++)
  776. {
  777. if (i != consoleplayer)
  778. st_fragscount += plyr->frags[i];
  779. else
  780. st_fragscount -= plyr->frags[i];
  781. }
  782. // get rid of chat window if up because of message
  783. if (!--st_msgcounter)
  784. st_chat = st_oldchat;
  785. }
  786. void ST_Ticker (void)
  787. {
  788. st_clock++;
  789. st_randomnumber = M_Random();
  790. ST_updateWidgets();
  791. st_oldhealth = plyr->health;
  792. }
  793. static int st_palette = 0;
  794. void ST_doPaletteStuff(void)
  795. {
  796. int palette;
  797. byte* pal;
  798. int cnt;
  799. int bzc;
  800. cnt = plyr->damagecount;
  801. if (plyr->powers[pw_strength])
  802. {
  803. // slowly fade the berzerk out
  804. bzc = 12 - (plyr->powers[pw_strength]>>6);
  805. if (bzc > cnt)
  806. cnt = bzc;
  807. }
  808. if (cnt)
  809. {
  810. palette = (cnt+7)>>3;
  811. if (palette >= NUMREDPALS)
  812. palette = NUMREDPALS-1;
  813. palette += STARTREDPALS;
  814. }
  815. else if (plyr->bonuscount)
  816. {
  817. palette = (plyr->bonuscount+7)>>3;
  818. if (palette >= NUMBONUSPALS)
  819. palette = NUMBONUSPALS-1;
  820. palette += STARTBONUSPALS;
  821. }
  822. else if ( plyr->powers[pw_ironfeet] > 4*32
  823. || plyr->powers[pw_ironfeet]&8)
  824. palette = RADIATIONPAL;
  825. else
  826. palette = 0;
  827. if (palette != st_palette)
  828. {
  829. st_palette = palette;
  830. pal = (byte *) W_CacheLumpNum (lu_palette, PU_CACHE)+palette*768;
  831. I_SetPalette (pal);
  832. }
  833. }
  834. void ST_drawWidgets(boolean refresh)
  835. {
  836. int i;
  837. // used by w_arms[] widgets
  838. st_armson = st_statusbaron && !deathmatch;
  839. // used by w_frags widget
  840. st_fragson = deathmatch && st_statusbaron;
  841. STlib_updateNum(&w_ready, refresh);
  842. for (i=0;i<4;i++)
  843. {
  844. STlib_updateNum(&w_ammo[i], refresh);
  845. STlib_updateNum(&w_maxammo[i], refresh);
  846. }
  847. STlib_updatePercent(&w_health, refresh);
  848. STlib_updatePercent(&w_armor, refresh);
  849. STlib_updateBinIcon(&w_armsbg, refresh);
  850. for (i=0;i<6;i++)
  851. STlib_updateMultIcon(&w_arms[i], refresh);
  852. STlib_updateMultIcon(&w_faces, refresh);
  853. for (i=0;i<3;i++)
  854. STlib_updateMultIcon(&w_keyboxes[i], refresh);
  855. STlib_updateNum(&w_frags, refresh);
  856. }
  857. void ST_doRefresh(void)
  858. {
  859. st_firsttime = false;
  860. // draw status bar background to off-screen buff
  861. ST_refreshBackground();
  862. // and refresh all widgets
  863. ST_drawWidgets(true);
  864. }
  865. void ST_diffDraw(void)
  866. {
  867. // update all widgets
  868. ST_drawWidgets(false);
  869. }
  870. void ST_Drawer (boolean fullscreen, boolean refresh)
  871. {
  872. st_statusbaron = (!fullscreen) || automapactive;
  873. st_firsttime = st_firsttime || refresh;
  874. // Do red-/gold-shifts from damage/items
  875. ST_doPaletteStuff();
  876. // If just after ST_Start(), refresh all
  877. if (st_firsttime) ST_doRefresh();
  878. // Otherwise, update as little as possible
  879. else ST_diffDraw();
  880. }
  881. void ST_loadGraphics(void)
  882. {
  883. int i;
  884. int j;
  885. int facenum;
  886. char namebuf[9];
  887. // Load the numbers, tall and short
  888. for (i=0;i<10;i++)
  889. {
  890. sprintf(namebuf, "STTNUM%d", i);
  891. tallnum[i] = (patch_t *) W_CacheLumpName(namebuf, PU_STATIC);
  892. sprintf(namebuf, "STYSNUM%d", i);
  893. shortnum[i] = (patch_t *) W_CacheLumpName(namebuf, PU_STATIC);
  894. }
  895. // Load percent key.
  896. //Note: why not load STMINUS here, too?
  897. tallpercent = (patch_t *) W_CacheLumpName("STTPRCNT", PU_STATIC);
  898. // key cards
  899. for (i=0;i<NUMCARDS;i++)
  900. {
  901. sprintf(namebuf, "STKEYS%d", i);
  902. keys[i] = (patch_t *) W_CacheLumpName(namebuf, PU_STATIC);
  903. }
  904. // arms background
  905. armsbg = (patch_t *) W_CacheLumpName("STARMS", PU_STATIC);
  906. // arms ownership widgets
  907. for (i=0;i<6;i++)
  908. {
  909. sprintf(namebuf, "STGNUM%d", i+2);
  910. // gray #
  911. arms[i][0] = (patch_t *) W_CacheLumpName(namebuf, PU_STATIC);
  912. // yellow #
  913. arms[i][1] = shortnum[i+2];
  914. }
  915. // face backgrounds for different color players
  916. sprintf(namebuf, "STFB%d", consoleplayer);
  917. faceback = (patch_t *) W_CacheLumpName(namebuf, PU_STATIC);
  918. // status bar background bits
  919. sbar = (patch_t *) W_CacheLumpName("STBAR", PU_STATIC);
  920. // face states
  921. facenum = 0;
  922. for (i=0;i<ST_NUMPAINFACES;i++)
  923. {
  924. for (j=0;j<ST_NUMSTRAIGHTFACES;j++)
  925. {
  926. sprintf(namebuf, "STFST%d%d", i, j);
  927. faces[facenum++] = W_CacheLumpName(namebuf, PU_STATIC);
  928. }
  929. sprintf(namebuf, "STFTR%d0", i); // turn right
  930. faces[facenum++] = W_CacheLumpName(namebuf, PU_STATIC);
  931. sprintf(namebuf, "STFTL%d0", i); // turn left
  932. faces[facenum++] = W_CacheLumpName(namebuf, PU_STATIC);
  933. sprintf(namebuf, "STFOUCH%d", i); // ouch!
  934. faces[facenum++] = W_CacheLumpName(namebuf, PU_STATIC);
  935. sprintf(namebuf, "STFEVL%d", i); // evil grin ;)
  936. faces[facenum++] = W_CacheLumpName(namebuf, PU_STATIC);
  937. sprintf(namebuf, "STFKILL%d", i); // pissed off
  938. faces[facenum++] = W_CacheLumpName(namebuf, PU_STATIC);
  939. }
  940. faces[facenum++] = W_CacheLumpName("STFGOD0", PU_STATIC);
  941. faces[facenum++] = W_CacheLumpName("STFDEAD0", PU_STATIC);
  942. }
  943. void ST_loadData(void)
  944. {
  945. lu_palette = W_GetNumForName ("PLAYPAL");
  946. ST_loadGraphics();
  947. }
  948. void ST_unloadGraphics(void)
  949. {
  950. int i;
  951. // unload the numbers, tall and short
  952. for (i=0;i<10;i++)
  953. {
  954. Z_ChangeTag(tallnum[i], PU_CACHE);
  955. Z_ChangeTag(shortnum[i], PU_CACHE);
  956. }
  957. // unload tall percent
  958. Z_ChangeTag(tallpercent, PU_CACHE);
  959. // unload arms background
  960. Z_ChangeTag(armsbg, PU_CACHE);
  961. // unload gray #'s
  962. for (i=0;i<6;i++)
  963. Z_ChangeTag(arms[i][0], PU_CACHE);
  964. // unload the key cards
  965. for (i=0;i<NUMCARDS;i++)
  966. Z_ChangeTag(keys[i], PU_CACHE);
  967. Z_ChangeTag(sbar, PU_CACHE);
  968. Z_ChangeTag(faceback, PU_CACHE);
  969. for (i=0;i<ST_NUMFACES;i++)
  970. Z_ChangeTag(faces[i], PU_CACHE);
  971. // Note: nobody ain't seen no unloading
  972. // of stminus yet. Dude.
  973. }
  974. void ST_unloadData(void)
  975. {
  976. ST_unloadGraphics();
  977. }
  978. void ST_initData(void)
  979. {
  980. int i;
  981. st_firsttime = true;
  982. plyr = &players[consoleplayer];
  983. st_clock = 0;
  984. st_chatstate = StartChatState;
  985. st_gamestate = FirstPersonState;
  986. st_statusbaron = true;
  987. st_oldchat = st_chat = false;
  988. st_cursoron = false;
  989. st_faceindex = 0;
  990. st_palette = -1;
  991. st_oldhealth = -1;
  992. for (i=0;i<NUMWEAPONS;i++)
  993. oldweaponsowned[i] = plyr->weaponowned[i];
  994. for (i=0;i<3;i++)
  995. keyboxes[i] = -1;
  996. STlib_init();
  997. }
  998. void ST_createWidgets(void)
  999. {
  1000. int i;
  1001. // ready weapon ammo
  1002. STlib_initNum(&w_ready,
  1003. ST_AMMOX,
  1004. ST_AMMOY,
  1005. tallnum,
  1006. &plyr->ammo[weaponinfo[plyr->readyweapon].ammo],
  1007. &st_statusbaron,
  1008. ST_AMMOWIDTH );
  1009. // the last weapon type
  1010. w_ready.data = plyr->readyweapon;
  1011. // health percentage
  1012. STlib_initPercent(&w_health,
  1013. ST_HEALTHX,
  1014. ST_HEALTHY,
  1015. tallnum,
  1016. &plyr->health,
  1017. &st_statusbaron,
  1018. tallpercent);
  1019. // arms background
  1020. STlib_initBinIcon(&w_armsbg,
  1021. ST_ARMSBGX,
  1022. ST_ARMSBGY,
  1023. armsbg,
  1024. &st_notdeathmatch,
  1025. &st_statusbaron);
  1026. // weapons owned
  1027. for(i=0;i<6;i++)
  1028. {
  1029. STlib_initMultIcon(&w_arms[i],
  1030. ST_ARMSX+(i%3)*ST_ARMSXSPACE,
  1031. ST_ARMSY+(i/3)*ST_ARMSYSPACE,
  1032. arms[i], (int *) &plyr->weaponowned[i+1],
  1033. &st_armson);
  1034. }
  1035. // frags sum
  1036. STlib_initNum(&w_frags,
  1037. ST_FRAGSX,
  1038. ST_FRAGSY,
  1039. tallnum,
  1040. &st_fragscount,
  1041. &st_fragson,
  1042. ST_FRAGSWIDTH);
  1043. // faces
  1044. STlib_initMultIcon(&w_faces,
  1045. ST_FACESX,
  1046. ST_FACESY,
  1047. faces,
  1048. &st_faceindex,
  1049. &st_statusbaron);
  1050. // armor percentage - should be colored later
  1051. STlib_initPercent(&w_armor,
  1052. ST_ARMORX,
  1053. ST_ARMORY,
  1054. tallnum,
  1055. &plyr->armorpoints,
  1056. &st_statusbaron, tallpercent);
  1057. // keyboxes 0-2
  1058. STlib_initMultIcon(&w_keyboxes[0],
  1059. ST_KEY0X,
  1060. ST_KEY0Y,
  1061. keys,
  1062. &keyboxes[0],
  1063. &st_statusbaron);
  1064. STlib_initMultIcon(&w_keyboxes[1],
  1065. ST_KEY1X,
  1066. ST_KEY1Y,
  1067. keys,
  1068. &keyboxes[1],
  1069. &st_statusbaron);
  1070. STlib_initMultIcon(&w_keyboxes[2],
  1071. ST_KEY2X,
  1072. ST_KEY2Y,
  1073. keys,
  1074. &keyboxes[2],
  1075. &st_statusbaron);
  1076. // ammo count (all four kinds)
  1077. STlib_initNum(&w_ammo[0],
  1078. ST_AMMO0X,
  1079. ST_AMMO0Y,
  1080. shortnum,
  1081. &plyr->ammo[0],
  1082. &st_statusbaron,
  1083. ST_AMMO0WIDTH);
  1084. STlib_initNum(&w_ammo[1],
  1085. ST_AMMO1X,
  1086. ST_AMMO1Y,
  1087. shortnum,
  1088. &plyr->ammo[1],
  1089. &st_statusbaron,
  1090. ST_AMMO1WIDTH);
  1091. STlib_initNum(&w_ammo[2],
  1092. ST_AMMO2X,
  1093. ST_AMMO2Y,
  1094. shortnum,
  1095. &plyr->ammo[2],
  1096. &st_statusbaron,
  1097. ST_AMMO2WIDTH);
  1098. STlib_initNum(&w_ammo[3],
  1099. ST_AMMO3X,
  1100. ST_AMMO3Y,
  1101. shortnum,
  1102. &plyr->ammo[3],
  1103. &st_statusbaron,
  1104. ST_AMMO3WIDTH);
  1105. // max ammo count (all four kinds)
  1106. STlib_initNum(&w_maxammo[0],
  1107. ST_MAXAMMO0X,
  1108. ST_MAXAMMO0Y,
  1109. shortnum,
  1110. &plyr->maxammo[0],
  1111. &st_statusbaron,
  1112. ST_MAXAMMO0WIDTH);
  1113. STlib_initNum(&w_maxammo[1],
  1114. ST_MAXAMMO1X,
  1115. ST_MAXAMMO1Y,
  1116. shortnum,
  1117. &plyr->maxammo[1],
  1118. &st_statusbaron,
  1119. ST_MAXAMMO1WIDTH);
  1120. STlib_initNum(&w_maxammo[2],
  1121. ST_MAXAMMO2X,
  1122. ST_MAXAMMO2Y,
  1123. shortnum,
  1124. &plyr->maxammo[2],
  1125. &st_statusbaron,
  1126. ST_MAXAMMO2WIDTH);
  1127. STlib_initNum(&w_maxammo[3],
  1128. ST_MAXAMMO3X,
  1129. ST_MAXAMMO3Y,
  1130. shortnum,
  1131. &plyr->maxammo[3],
  1132. &st_statusbaron,
  1133. ST_MAXAMMO3WIDTH);
  1134. }
  1135. static boolean st_stopped = true;
  1136. void ST_Start (void)
  1137. {
  1138. if (!st_stopped)
  1139. ST_Stop();
  1140. ST_initData();
  1141. ST_createWidgets();
  1142. st_stopped = false;
  1143. }
  1144. void ST_Stop (void)
  1145. {
  1146. if (st_stopped)
  1147. return;
  1148. I_SetPalette (W_CacheLumpNum (lu_palette, PU_CACHE));
  1149. st_stopped = true;
  1150. }
  1151. void ST_Init (void)
  1152. {
  1153. veryfirsttime = 0;
  1154. ST_loadData();
  1155. screens[4] = (byte *) Z_Malloc(ST_WIDTH*ST_HEIGHT, PU_STATIC, 0);
  1156. }