Revert "fix: we can have more priorities than "real" weapons (consider berserk knuckl...
[d2df-sdl.git] / src / game / g_holmes.inc
blob45237b16b143d177e9d9cc5072ceffdbeaca4f19
1 (* Copyright (C)  Doom 2D: Forever Developers
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * (at your option) any later version.
7  *
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  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15  *)
16 // ////////////////////////////////////////////////////////////////////////// //
17 function monsTypeToString (mt: Byte): AnsiString;
18 begin
19   case mt of
20     MONSTER_NONE: begin result := 'none'; exit; end;
21     MONSTER_DEMON: begin result := 'demon'; exit; end;
22     MONSTER_IMP: begin result := 'imp'; exit; end;
23     MONSTER_ZOMBY: begin result := 'zombie'; exit; end;
24     MONSTER_SERG: begin result := 'serg'; exit; end;
25     MONSTER_CYBER: begin result := 'cyber'; exit; end;
26     MONSTER_CGUN: begin result := 'cgun'; exit; end;
27     MONSTER_BARON: begin result := 'baron'; exit; end;
28     MONSTER_KNIGHT: begin result := 'knight'; exit; end;
29     MONSTER_CACO: begin result := 'caco'; exit; end;
30     MONSTER_SOUL: begin result := 'soul'; exit; end;
31     MONSTER_PAIN: begin result := 'pain'; exit; end;
32     MONSTER_SPIDER: begin result := 'spider'; exit; end;
33     MONSTER_BSP: begin result := 'bsp'; exit; end;
34     MONSTER_MANCUB: begin result := 'mancubus'; exit; end;
35     MONSTER_SKEL: begin result := 'skel'; exit; end;
36     MONSTER_VILE: begin result := 'vile'; exit; end;
37     MONSTER_FISH: begin result := 'fish'; exit; end;
38     MONSTER_BARREL: begin result := 'barrel'; exit; end;
39     MONSTER_ROBO: begin result := 'robo'; exit; end;
40     MONSTER_MAN: begin result := 'man'; exit; end;
41   end;
42   result := 'unknown';
43 end;
46 function monsBehToString (bt: Byte): AnsiString;
47 begin
48   case bt of
49     BH_NORMAL: begin result := 'normal'; exit; end;
50     BH_KILLER: begin result := 'killer'; exit; end;
51     BH_MANIAC: begin result := 'maniac'; exit; end;
52     BH_INSANE: begin result := 'insane'; exit; end;
53     BH_CANNIBAL: begin result := 'cannibal'; exit; end;
54     BH_GOOD: begin result := 'good'; exit; end;
55   end;
56   result := 'unknown';
57 end;
60 function monsStateToString (st: Byte): AnsiString;
61 begin
62   case st of
63     MONSTATE_SLEEP: begin result := 'sleep'; exit; end;
64     MONSTATE_GO: begin result := 'go'; exit; end;
65     MONSTATE_RUN: begin result := 'run'; exit; end;
66     MONSTATE_CLIMB: begin result := 'climb'; exit; end;
67     MONSTATE_DIE: begin result := 'die'; exit; end;
68     MONSTATE_DEAD: begin result := 'dead'; exit; end;
69     MONSTATE_ATTACK: begin result := 'attack'; exit; end;
70     MONSTATE_SHOOT: begin result := 'shoot'; exit; end;
71     MONSTATE_PAIN: begin result := 'pain'; exit; end;
72     MONSTATE_WAIT: begin result := 'wait'; exit; end;
73     MONSTATE_REVIVE: begin result := 'revive'; exit; end;
74     MONSTATE_RUNOUT: begin result := 'runout'; exit; end;
75   end;
76   result := 'unknown';
77 end;
80 // ////////////////////////////////////////////////////////////////////////// //
81 function typeKind2Str (t: TTypeKind): AnsiString;
82 begin
83   case t of
84     tkUnknown: result := 'Unknown';
85     tkInteger: result := 'Integer';
86     tkChar: result := 'Char';
87     tkEnumeration: result := 'Enumeration';
88     tkFloat: result := 'Float';
89     tkSet: result := 'Set';
90     tkMethod: result := 'Method';
91     tkSString: result := 'SString';
92     tkLString: result := 'LString';
93     tkAString: result := 'AString';
94     tkWString: result := 'WString';
95     tkVariant: result := 'Variant';
96     tkArray: result := 'Array';
97     tkRecord: result := 'Record';
98     tkInterface: result := 'Interface';
99     tkClass: result := 'Class';
100     tkObject: result := 'Object';
101     tkWChar: result := 'WChar';
102     tkBool: result := 'Bool';
103     tkInt64: result := 'Int64';
104     tkQWord: result := 'QWord';
105     tkDynArray: result := 'DynArray';
106     tkInterfaceRaw: result := 'InterfaceRaw';
107     tkProcVar: result := 'ProcVar';
108     tkUString: result := 'UString';
109     tkUChar: result := 'UChar';
110     tkHelper: result := 'Helper';
111     tkFile: result := 'File';
112     tkClassRef: result := 'ClassRef';
113     tkPointer: result := 'Pointer';
114     else result := '<unknown>';
115   end;
116 end;
119 procedure dumpPublishedProperties (obj: TObject);
121   pt: PTypeData;
122   pi: PTypeInfo;
123   i, j: Integer;
124   pp: PPropList;
125 begin
126   if (obj = nil) then exit;
127   e_LogWritefln('Object of type ''%s'':', [obj.ClassName]);
128   pi := obj.ClassInfo;
129   pt := GetTypeData(pi);
130   e_LogWritefln('property count: %s', [pt.PropCount]);
131   GetMem(pp, pt^.PropCount*sizeof(Pointer));
132   try
133     j := GetPropList(pi, [tkInteger, tkBool, tkSString, tkLString, tkAString, tkSet, tkEnumeration], pp);
134     //e_LogWritefln('ordinal property count: %s', [j]);
135     for i := 0 to j-1 do
136     begin
137       if (typinfo.PropType(obj, pp^[i].name) in [tkSString, tkLString, tkAString]) then
138       begin
139         e_LogWritefln('  #%s: <%s>; type: %s; value: <%s>', [i+1, pp^[i].name, typeKind2Str(typinfo.PropType(obj, pp^[i].name)), GetStrProp(obj, pp^[i])]);
140       end
141       else if (typinfo.PropType(obj, pp^[i].name) = tkSet) then
142       begin
143         e_LogWritefln('  #%s: <%s>; type: %s; value: %s', [i+1, pp^[i].name, typeKind2Str(typinfo.PropType(obj, pp^[i].name)), GetSetProp(obj, pp^[i], true)]);
144       end
145       else if (typinfo.PropType(obj, pp^[i].name) = tkEnumeration) then
146       begin
147         e_LogWritefln('  #%s: <%s>; type: %s; value: <%s>', [i+1, pp^[i].name, typeKind2Str(typinfo.PropType(obj, pp^[i].name)), GetEnumProp(obj, pp^[i])]);
148       end
149       else
150       begin
151         e_LogWritefln('  #%s: <%s>; type: %s; value: %s', [i+1, pp^[i].name, typeKind2Str(typinfo.PropType(obj, pp^[i].name)), GetOrdProp(obj, pp^[i])]);
152       end;
153     end;
154   finally
155     FreeMem(pp);
156   end;
157 end;
160 //FIXME: autogenerate
161 function trigType2Str (ttype: Integer): AnsiString;
162 begin
163   result := '<unknown>';
164   case ttype of
165     TRIGGER_NONE: result := 'none';
166     TRIGGER_EXIT: result := 'exit';
167     TRIGGER_TELEPORT: result := 'teleport';
168     TRIGGER_OPENDOOR: result := 'opendoor';
169     TRIGGER_CLOSEDOOR: result := 'closedoor';
170     TRIGGER_DOOR: result := 'door';
171     TRIGGER_DOOR5: result := 'door5';
172     TRIGGER_CLOSETRAP: result := 'closetrap';
173     TRIGGER_TRAP: result := 'trap';
174     TRIGGER_PRESS: result := 'press';
175     TRIGGER_SECRET: result := 'secret';
176     TRIGGER_LIFTUP: result := 'liftup';
177     TRIGGER_LIFTDOWN: result := 'liftdown';
178     TRIGGER_LIFT: result := 'lift';
179     TRIGGER_TEXTURE: result := 'texture';
180     TRIGGER_ON: result := 'on';
181     TRIGGER_OFF: result := 'off';
182     TRIGGER_ONOFF: result := 'onoff';
183     TRIGGER_SOUND: result := 'sound';
184     TRIGGER_SPAWNMONSTER: result := 'spawnmonster';
185     TRIGGER_SPAWNITEM: result := 'spawnitem';
186     TRIGGER_MUSIC: result := 'music';
187     TRIGGER_PUSH: result := 'push';
188     TRIGGER_SCORE: result := 'score';
189     TRIGGER_MESSAGE: result := 'message';
190     TRIGGER_DAMAGE: result := 'damage';
191     TRIGGER_HEALTH: result := 'health';
192     TRIGGER_SHOT: result := 'shot';
193     TRIGGER_EFFECT: result := 'effect';
194     TRIGGER_SCRIPT: result := 'script';
195   end;
196 end;