Debian Codegraph @

netgames/entropy/EntropyRoom.cpp

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Logfile: /DescentIII/Main/entropy/EntropyRoom.cpp $
21 * $Revision: 1.1.1.1 $
22 * $Date: 2003/08/26 03:57:41 $
23 * $Author: kevinb $
24 *
25 * <insert description of file here>
26 *
27 * $Log: EntropyRoom.cpp,v $
28 * Revision 1.1.1.1 2003/08/26 03:57:41 kevinb
29 * initial 1.5 import
30 *
31 *
32 * 15 10/21/99 9:28p Jeff
33 * B.A. Macintosh code merge
34 *
35 * 14 5/19/99 3:24p Jason
36 * fixed wrong ordering of InitObjectScripts and MultiSendObject
37 *
38 * 13 5/19/99 2:42a Jeff
39 * call correct NewUIGameWindow functions
40 *
41 * 12 5/12/99 11:28a Jeff
42 * added sourcesafe comment block
43 *
44 * $NoKeywords: $
45 */
46
47 #include "gamedll_header.h"cxx . . $ `<file>/netgames/includes/gamedll_header.h`/
48 #include <string.h>
49 #include <stdio.h>
50 #include <stdlib.h>
51 #include <ctype.h>
52 #include <math.h>
53 #include "idmfc.h"cxx . . $ `<file>/netgames/includes/idmfc.h`/
54 #include "Entropystr.h"cxx . . $ `<file>/netgames/entropy/Entropystr.h`/
55 #include "EntropyAux.h"cxx . . $ `<file>/netgames/entropy/EntropyAux.h`/
56
57 extern IDMFCcxx . . $ IDMFC# *DMFCBasecxx . . $ DMFCBase.;
58
59 bool PaintRoomWithTexturecxx . . $ PaintRoomWithTexture(cf9ef193275fa6d8).(int text, int roomnum) {
60 if (ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(roomnum)) {
61 Int3cxx . . $ `netgames/includes/DMFC.h:378:9`!();
62 return false;
63 }
64
65 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!((roomnum >= 0) && (roomnum <= DMFCBase->GetHighestRoomIndex()));
66 if ((roomnum < 0) || (roomnum > DMFCBasecxx . . $ DMFCBase.->GetHighestRoomIndexcxx . . $ IDMFC#GetHighestRoomIndex(b126dc7c1de90089).()))
67 return false;
68
69 if (dRoomscxx . . $ dRooms.[roomnum].flagscxx . . $ room#flags. & RF_EXTERNALcxx . . $ `Descent3/room_external.h:177:9`!)
70 return false;
71
72 bool has_goalfaces = false;
73 int t;
74 for (t = 0; t < dRoomscxx . . $ dRooms.[roomnum].num_facescxx . . $ room#num_faces.; t++) {
75 if (dRoomscxx . . $ dRooms.[roomnum].facescxx . . $ room#faces.[t].flagscxx . . $ face#flags. & FF_GOALFACEcxx . . $ `Descent3/room_external.h:125:9`!) {
76 has_goalfaces = true;
77 break;
78 }
79 }
80
81 texturecxx . . $ texture# *GameTextures = DMFCBasecxx . . $ DMFCBase.->GetGameTexturescxx . . $ IDMFC#GetGameTextures(204733a467239a0f).();
82 dRoomscxx . . $ dRooms.[roomnum].room_change_flagscxx . . $ room#room_change_flags. |= RCF_TEXTUREcxx . . $ `Descent3/multi_world_state.h:57:9`!;
83
84 for (t = 0; t < dRoomscxx . . $ dRooms.[roomnum].num_facescxx . . $ room#num_faces.; t++) {
85 texturecxx . . $ texture# *texp = &GameTextures[dRoomscxx . . $ dRooms.[roomnum].facescxx . . $ room#faces.[t].tmapcxx . . $ face#tmap.];
86 if ((!(texp->flagscxx . . $ texture#flags. & TF_ALPHAcxx . . $ `Descent3/gametexture.h:223:9`!)) && texp->rcxx . . $ texture#r. < .01 && texp->gcxx . . $ texture#g. < .01 && texp->bcxx . . $ texture#b. < .01) {
87 if (!has_goalfaces || (dRoomscxx . . $ dRooms.[roomnum].facescxx . . $ room#faces.[t].flagscxx . . $ face#flags. & FF_GOALFACEcxx . . $ `Descent3/room_external.h:125:9`!)) {
88 dRoomscxx . . $ dRooms.[roomnum].facescxx . . $ room#faces.[t].tmapcxx . . $ face#tmap. = text;
89 dRoomscxx . . $ dRooms.[roomnum].facescxx . . $ room#faces.[t].flagscxx . . $ face#flags. |= FF_TEXTURE_CHANGEDcxx . . $ `Descent3/room_external.h:115:9`!;
90 }
91 }
92 }
93 return true;
94 }
95
96 int SpewObjectInRoomcxx . . $ SpewObjectInRoom(2326284602b0bb2d).(int type, int id, int roomnum) {
97 if (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!)
98 return -1;
99
100 vectorcxx . . $ vector# vpos;
101 int objnum;
102
103 DLLComputeRoomCenter(&vpos, &dRoomscxx . . $ dRooms.[roomnum]);
104 objnum = DLLObjCreate(type, id, roomnum, &vpos, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!);
105 if (objnum == -1)
106 return -1;
107
108 objectcxx . . $ object# *obj = &dObjectscxx . . $ dObjects.[objnum];
109
110 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(obj->movement_type == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!);
111 if (obj->movement_typecxx . . $ object#movement_type. != MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!)
112 return -1;
113
114 // Set random velocity for powerups
115 obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity..xcxx . . $ vector#x. = ((float)rand() / static_cast<float>(RAND_MAXcxx . . $ `<external>/10696550936717951914/stdlib.h:87:9`!)) * 20.0;
116 obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity..zcxx . . $ vector#z. = ((float)rand() / static_cast<float>(RAND_MAXcxx . . $ `<external>/10696550936717951914/stdlib.h:87:9`!)) * 20.0;
117 obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity..ycxx . . $ vector#y. = ((float)rand() / static_cast<float>(RAND_MAXcxx . . $ `<external>/10696550936717951914/stdlib.h:87:9`!)) * 20.0;
118
119 DLLMultiSendObject(obj, 0, true);
120
121 DLLInitObjectScripts(obj, true);
122
123 SendVirusCreatecxx . . $ SendVirusCreate(419c470199a90a97).(obj);
124
125 return objnum;
126 }
127
128 void DoServerConfigureDialogcxx . . $ DoServerConfigureDialog(49f6e7a06ebc5aa8).(void) {
129 if (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!)
130 return;
131
132 char tempbuffer[20];
133 bool exit_menu = false;
134
135 void *start_game_text_off = DLLCreateNewUITextItem(TXT_STARTGAMEcxx . . $ `netgames/entropy/Entropystr.h:59:9`!, GR_WHITEcxx . . $ GR_WHITE., -1);
136 void *start_game_text_on = DLLCreateNewUITextItem(TXT_STARTGAMEcxx . . $ `netgames/entropy/Entropystr.h:59:9`!, GR_REDcxx . . $ GR_RED., -1);
137 void *virus_pk_text = DLLCreateNewUITextItem(TXT_VIRUSCREDITcxx . . $ `netgames/entropy/Entropystr.h:60:9`!, GR_WHITEcxx . . $ GR_WHITE., -1);
138
139 void *main_wnd = DLLNewUIGameWindowCreate(0, 0, 256, 256, UIF_PROCESS_ALLcxx . . $ `netgames/includes/gamedll_header.h:74:9`! | UIF_CENTERcxx . . $ `netgames/includes/gamedll_header.h:63:9`!);
140
141 int cury = 20;
142 void *virus_pk_edit = DLLEditCreate(main_wnd, 13, 40, cury, 80, 15, 0);
143 cury += 35;
144 void *start_game_hs =
145 DLLHotSpotCreate(main_wnd, UID_OKcxx . . $ `netgames/includes/DMFC.h:494:9`!, K_ENTERcxx . . $ `netgames/includes/DMFCKeyCodes.h:98:9`!, start_game_text_off, start_game_text_on, 40, cury, 130, 15, 0);
146 cury += 20;
147
148 snprintf(tempbuffer, sizeof(tempbuffer), "%d", 2);
149 DLLEditSetText(virus_pk_edit, tempbuffer);
150
151 DLLNewUIGameWindowOpen(main_wnd);
152
153 while (!exit_menu) {
154 int res;
155 res = DLLPollUI();
156
157 if (res == -1)
158 continue;
159
160 // handle all UI results.
161 switch (res) {
162 case NEWUIRES_FORCEQUITcxx . . $ `netgames/includes/DMFC.h:493:9`!:
163 exit_menu = true;
164 break;
165 case 13: // virus_pk edit
166 break;
167 case UID_OKcxx . . $ `netgames/includes/DMFC.h:494:9`!: // start game
168 exit_menu = true;
169 DLLEditGetText(virus_pk_edit, tempbuffer, 20);
170 int newpk = atoi(tempbuffer);
171 DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "New Virus/Kill = %d\n", newpk);
172 break;
173 };
174 }
175 DLLNewUIGameWindowClose(main_wnd);
176 DLLNewUIGameWindowDestroy(main_wnd);
177
178 DLLRemoveUITextItem(start_game_text_on);
179 DLLRemoveUITextItem(start_game_text_off);
180 DLLRemoveUITextItem(virus_pk_text);
181
182 DLLDeleteUIItem(main_wnd);
183 DLLDeleteUIItem(virus_pk_edit);
184 DLLDeleteUIItem(start_game_hs);
185 }