1 /* 2 3 Copyright (C) 2015-2018 Night Dive Studios, LLC. 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 */ 19 #ifndef __OBJCRIT_H 20 #define __OBJCRIT_H 21 22 /* 23 * $Source: r:/prj/cit/src/inc/RCS/objcrit.h $ 24 * $Revision: 1.41 $ 25 * $Author: minman $ 26 * $Date: 1994/08/02 22:09:15 $ 27 * 28 * 29 */ 30 31 // Includes 32 #include "objsim.h" 33 #include "objclass.h" 34 35 #pragma pack(push,2) 36 37 typedef struct { 38 // COMMON_OBJSPEC_FIELDS; 39 union { 40 ObjID id; 41 ObjSpecID headused; 42 }; 43 union { 44 ObjSpecID next; 45 ObjSpecID headfree; 46 }; 47 ObjSpecID prev; 48 fix des_heading, des_speed, urgency; 49 short wait_frames; 50 ushort flags; 51 uint32_t attack_count; // can attack when game time reaches this 52 ubyte ai_mode; 53 ubyte mood; 54 ubyte orders; 55 ubyte current_posture; 56 char x1; 57 char y1; 58 char dest_x; // Current destination coordinates 59 char dest_y; 60 char pf_x; // where we are currently pathfinding to (what our current step is) 61 char pf_y; 62 char path_id; // what pathfinding track we are on 63 char path_tries; // how many frames have we been trying to get to the 64 // next step on our pathfinding? 65 ObjID loot1, loot2; // Some loot to get when we destroy critter 66 // Note: Num frames is gotten from object properties 67 fix sidestep; 68 } ObjCritter; 69 70 typedef struct { 71 // COMMON_OBJSPEC_FIELDS; 72 union { 73 ObjID id; 74 ObjSpecID headused; 75 }; 76 union { 77 ObjSpecID next; 78 ObjSpecID headfree; 79 }; 80 ObjSpecID prev; 81 fix des_heading, des_speed, urgency; 82 short wait_frames; 83 short base_time_interval; 84 uint32_t attack_count; // can attack when game time reaches this 85 ubyte ai_mode; 86 ubyte mood; 87 ubyte orders; 88 ubyte current_posture; 89 char x1; 90 char y1; 91 char dest_x; // Current destination coordinate 92 char dest_y; 93 char old_x; // the bin we were in prior to being in this bin 94 char old_y; 95 char last_x; // the bin we were in last ai cycle 96 char last_y; 97 ObjID loot1, loot2; // Some loot to get when we destroy critter 98 // Note: Num frames is gotten from object properties 99 } oldObjCritter; 100 101 // -------------------------- 102 // Class typedefs 103 104 #define NUM_CRITTER_POSTURES 8 105 106 typedef struct _CritterAttack { 107 int damage_type; 108 short damage_modifier; 109 ubyte offense_value; 110 ubyte penetration; 111 ubyte attack_mass; 112 short attack_velocity; 113 ubyte accuracy; 114 ubyte att_range; 115 int speed; // Wait this long between attacks .. in game_time units 116 int slow_proj; // what, if any, slow projectile we fire 117 } CritterAttack; 118 119 #define NUM_ALTERNATE_ATTACKS 2 120 #define MAX_CRITTER_VIEWS 8 121 122 typedef struct CritterProp { 123 ubyte intelligence; 124 CritterAttack attacks[NUM_ALTERNATE_ATTACKS]; 125 ubyte perception; // each ai interval that player is seeable, this is percent of detection 126 ubyte defense; 127 ubyte proj_offset; // slow projectile offset (y) 128 // int speed; 129 int flags; // flying??, shield??, fixed point?, does it move?? 130 uchar mirror; // should it's views be mirrored? 131 ubyte frames[NUM_CRITTER_POSTURES]; // number of animation frames. 132 ubyte anim_speed; 133 ubyte attack_sound; // play this when attacking. -1 for no sound. 134 ubyte near_sound; // play when creature is nearby 135 ubyte hurt_sound; // play when damaged a large percentage 136 ubyte death_sound; // play when dying 137 ubyte notice_sound; // play when it notices the player 138 int corpse; // object triple of thing to put here when we die. 139 ubyte views; // number of views for multi-view postures 140 ubyte alt_perc; // percentage of using alternate attack 141 ubyte disrupt_perc; // chance of being disrupted if hit while attacking 142 ubyte treasure_type; // what kind of loot this critter carries. 143 ubyte hit_effect; // what kind of class of hit effects should we do 144 ubyte fire_frame; // what frame do we fire on 145 } CritterProp; 146 147 // ------------------ 148 // Subclass typedefs 149 150 typedef struct MutantCritterProp { 151 ubyte dummy; 152 } MutantCritterProp; 153 154 typedef struct RobotCritterProp { 155 ubyte backup_weapon; 156 ubyte metal_thickness; 157 } RobotCritterProp; 158 159 typedef struct CyborgCritterProp { 160 short shield_energy; 161 } CyborgCritterProp; 162 163 #define NUM_VCOLORS 3 164 typedef struct CyberCritterProp { 165 uchar vcolors[NUM_VCOLORS]; 166 uchar alt_vcolors[NUM_VCOLORS]; 167 } CyberCritterProp; 168 169 #define EMPTY_STRUCTS 170 171 typedef struct RobobabeCritterProp { 172 #ifdef EMPTY_STRUCTS 173 ubyte dummy; 174 #endif 175 } RobobabeCritterProp; 176 177 // Quantity defines - subclasses 178 179 #define NUM_MUTANT_CRITTER 9 180 #define NUM_ROBOT_CRITTER 12 181 #define NUM_CYBORG_CRITTER 7 182 #define NUM_CYBER_CRITTER 7 183 // Note that for our purposes, ROBOBABE = PLOT which might in itself tell you something 184 // significant about our game 185 #define NUM_ROBOBABE_CRITTER 2 186 187 #define NUM_CRITTER \ 188 (NUM_MUTANT_CRITTER + NUM_ROBOT_CRITTER + NUM_CYBORG_CRITTER + NUM_CYBER_CRITTER + NUM_ROBOBABE_CRITTER) 189 190 // Enumeration of subclasses 191 // 192 193 // Critter 194 #define CRITTER_SUBCLASS_MUTANT 0 195 #define CRITTER_SUBCLASS_ROBOT 1 196 #define CRITTER_SUBCLASS_CYBORG 2 197 #define CRITTER_SUBCLASS_CYBER 3 198 #define CRITTER_SUBCLASS_ROBOBABE 4 199 200 // Lots of posture stuff... 201 202 // view = 0-7 side views at angles 203 // view = 8 top 204 // view = 9 bottom 205 206 #define FRONT_VIEW 6 207 208 #define STANDING_CRITTER_POSTURE 0 209 #define MOVING_CRITTER_POSTURE 1 210 #define ATTACKING_CRITTER_POSTURE 2 211 #define ATTACK_REST_CRITTER_POSTURE 3 212 #define KNOCKBACK_CRITTER_POSTURE 4 213 #define DEATH_CRITTER_POSTURE 5 214 #define DISRUPT_CRITTER_POSTURE 6 215 #define ATTACKING2_CRITTER_POSTURE 7 216 217 #define FIRST_FRONT_POSTURE ATTACKING_CRITTER_POSTURE 218 #define DEFAULT_CRITTER_POSTURE STANDING_CRITTER_POSTURE 219 220 // single-view postures 221 #define CRITTER_ATTACK_BASE RES_bmCritterAttack_0 222 #define CRITTER_ATTACK2_BASE RES_bmCritterAttack2_0 223 #define CRITTER_ATTACK_REST_BASE RES_bmCritterAttackRest_0 224 #define CRITTER_DEATH_BASE RES_bmCritterDeath_0 225 #define CRITTER_DISRUPT_BASE RES_bmCritterDisrupt_0 226 #define CRITTER_KNOCKBACK_BASE RES_bmCritterKnockback_0 227 228 // multi-view postures 229 #define CRITTER_MOVE_BASE RES_bmCritterMovement_0 230 #define CRITTER_STAND_BASE RES_bmCritterStanding_0 231 232 // Properties of subclasses 233 // 234 235 #ifdef __OBJSIM_SRC 236 CritterProp CritterProps[NUM_CRITTER]; 237 MutantCritterProp MutantCritterProps[NUM_MUTANT_CRITTER]; 238 RobotCritterProp RobotCritterProps[NUM_ROBOT_CRITTER]; 239 CyborgCritterProp CyborgCritterProps[NUM_CYBORG_CRITTER]; 240 CyberCritterProp CyberCritterProps[NUM_CYBER_CRITTER]; 241 RobobabeCritterProp RobobabeCritterProps[NUM_ROBOBABE_CRITTER]; 242 #else 243 extern CritterProp CritterProps[NUM_CRITTER]; 244 extern MutantCritterProp MutantCritterProps[NUM_MUTANT_CRITTER]; 245 extern RobotCritterProp RobotCritterProps[NUM_ROBOT_CRITTER]; 246 extern CyborgCritterProp CyborgCritterProps[NUM_CYBORG_CRITTER]; 247 extern CyberCritterProp CyberCritterProps[NUM_CYBER_CRITTER]; 248 extern RobobabeCritterProp RobobabeCritterProps[NUM_ROBOBABE_CRITTER]; 249 #endif 250 251 #ifdef __OBJSIM_SRC 252 ObjCritter objCritters[NUM_OBJECTS_CRITTER]; 253 ObjCritter default_critter; 254 #else 255 extern ObjCritter objCritters[NUM_OBJECTS_CRITTER]; 256 extern ObjCritter default_critter; 257 #endif 258 259 #define get_crit_posture(osid) (objCritters[osid].current_posture & 0xFu) 260 #define set_crit_posture(osid, newpos) \ 261 objCritters[osid].current_posture = (objCritters[osid].current_posture & 0xF0u) + newpos 262 263 #define get_crit_view(oisd) (objCritters[osid].current_posture >> 8) 264 #define set_crit_view(osid, newview) \ 265 objCritters[osid].current_posture = (newview << 8) + (objCritters[osid].current_posture & 0xF) 266 267 #pragma pack(pop) 268 269 #endif // __OBJCRIT_H 270