Cleanup proto_instance.h

See #42
This commit is contained in:
Alexander Batalov 2022-06-19 14:32:00 +03:00
parent b3f6721ee1
commit ca99fc0ad2
2 changed files with 41 additions and 42 deletions

View File

@ -13,6 +13,7 @@
#include "interface.h" #include "interface.h"
#include "item.h" #include "item.h"
#include "map.h" #include "map.h"
#include "message.h"
#include "object.h" #include "object.h"
#include "palette.h" #include "palette.h"
#include "perk.h" #include "perk.h"
@ -30,8 +31,28 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
static int _obj_remove_from_inven(Object* critter, Object* item);
static int _obj_use_book(Object* item_obj);
static int _obj_use_flare(Object* critter_obj, Object* item_obj);
static int _obj_use_radio(Object* item_obj);
static int _obj_use_explosive(Object* explosive);
static int _obj_use_power_on_car(Object* ammo);
static int _obj_use_misc_item(Object* item_obj);
static int _protinstTestDroppedExplosive(Object* a1);
static int _protinst_default_use_item(Object* a1, Object* a2, Object* item);
static int useLadderDown(Object* a1, Object* ladder, int a3);
static int useLadderUp(Object* a1, Object* ladder, int a3);
static int useStairs(Object* a1, Object* stairs, int a3);
static int _set_door_state_open(Object* a1, Object* a2);
static int _set_door_state_closed(Object* a1, Object* a2);
static int _check_door_state(Object* a1, Object* a2);
static bool _obj_is_lockable(Object* obj);
static bool _obj_is_openable(Object* obj);
static int objectOpenClose(Object* obj);
static bool objectIsJammed(Object* obj);
// 0x49A990 // 0x49A990
MessageListItem stru_49A990; static MessageListItem stru_49A990;
// 0x49A9A0 // 0x49A9A0
int _obj_sid(Object* object, int* sidPtr) int _obj_sid(Object* object, int* sidPtr)
@ -569,7 +590,7 @@ int _obj_pickup(Object* critter, Object* item)
} }
// 0x49B73C // 0x49B73C
int _obj_remove_from_inven(Object* critter, Object* item) static int _obj_remove_from_inven(Object* critter, Object* item)
{ {
Rect updatedRect; Rect updatedRect;
int fid; int fid;
@ -702,7 +723,7 @@ int _obj_destroy(Object* obj)
// Read a book. // Read a book.
// //
// 0x49B9F0 // 0x49B9F0
int _obj_use_book(Object* book) static int _obj_use_book(Object* book)
{ {
MessageListItem messageListItem; MessageListItem messageListItem;
@ -790,7 +811,7 @@ int _obj_use_book(Object* book)
// Light a flare. // Light a flare.
// //
// 0x49BBA8 // 0x49BBA8
int _obj_use_flare(Object* critter_obj, Object* flare) static int _obj_use_flare(Object* critter_obj, Object* flare)
{ {
MessageListItem messageListItem; MessageListItem messageListItem;
@ -825,7 +846,7 @@ int _obj_use_flare(Object* critter_obj, Object* flare)
} }
// 0x49BC60 // 0x49BC60
int _obj_use_radio(Object* item) static int _obj_use_radio(Object* item)
{ {
Script* scr; Script* scr;
@ -844,7 +865,7 @@ int _obj_use_radio(Object* item)
} }
// 0x49BCB4 // 0x49BCB4
int _obj_use_explosive(Object* explosive) static int _obj_use_explosive(Object* explosive)
{ {
MessageListItem messageListItem; MessageListItem messageListItem;
@ -913,7 +934,7 @@ int _obj_use_explosive(Object* explosive)
// Returns 1 when car is recharged. // Returns 1 when car is recharged.
// //
// 0x49BDE8 // 0x49BDE8
int _obj_use_power_on_car(Object* item) static int _obj_use_power_on_car(Object* item)
{ {
MessageListItem messageListItem; MessageListItem messageListItem;
int messageNum; int messageNum;
@ -961,7 +982,7 @@ int _obj_use_power_on_car(Object* item)
} }
// 0x49BE88 // 0x49BE88
int _obj_use_misc_item(Object* item) static int _obj_use_misc_item(Object* item)
{ {
if (item == NULL) { if (item == NULL) {
@ -1052,7 +1073,7 @@ int _protinst_use_item(Object* critter, Object* item)
} }
// 0x49BFE8 // 0x49BFE8
int _protinstTestDroppedExplosive(Object* a1) static int _protinstTestDroppedExplosive(Object* a1)
{ {
if (a1->pid == PROTO_ID_DYNAMITE_II || a1->pid == PROTO_ID_PLASTIC_EXPLOSIVES_II) { if (a1->pid == PROTO_ID_DYNAMITE_II || a1->pid == PROTO_ID_PLASTIC_EXPLOSIVES_II) {
Attack attack; Attack attack;
@ -1136,7 +1157,7 @@ int _obj_use_item(Object* a1, Object* a2)
} }
// 0x49C240 // 0x49C240
int _protinst_default_use_item(Object* a1, Object* a2, Object* item) static int _protinst_default_use_item(Object* a1, Object* a2, Object* item)
{ {
char formattedText[90]; char formattedText[90];
MessageListItem messageListItem; MessageListItem messageListItem;
@ -1475,7 +1496,7 @@ int _obj_use(Object* a1, Object* a2)
} }
// 0x49C900 // 0x49C900
int useLadderDown(Object* a1, Object* ladder, int a3) static int useLadderDown(Object* a1, Object* ladder, int a3)
{ {
int builtTile = ladder->data.scenery.ladder.field_4; int builtTile = ladder->data.scenery.ladder.field_4;
if (builtTile == -1) { if (builtTile == -1) {
@ -1509,7 +1530,7 @@ int useLadderDown(Object* a1, Object* ladder, int a3)
} }
// 0x49C9A4 // 0x49C9A4
int useLadderUp(Object* a1, Object* ladder, int a3) static int useLadderUp(Object* a1, Object* ladder, int a3)
{ {
int builtTile = ladder->data.scenery.ladder.field_4; int builtTile = ladder->data.scenery.ladder.field_4;
if (builtTile == -1) { if (builtTile == -1) {
@ -1543,7 +1564,7 @@ int useLadderUp(Object* a1, Object* ladder, int a3)
} }
// 0x49CA48 // 0x49CA48
int useStairs(Object* a1, Object* stairs, int a3) static int useStairs(Object* a1, Object* stairs, int a3)
{ {
int builtTile = stairs->data.scenery.stairs.field_4; int builtTile = stairs->data.scenery.stairs.field_4;
if (builtTile == -1) { if (builtTile == -1) {
@ -1577,21 +1598,21 @@ int useStairs(Object* a1, Object* stairs, int a3)
} }
// 0x49CAF4 // 0x49CAF4
int _set_door_state_open(Object* a1, Object* a2) static int _set_door_state_open(Object* a1, Object* a2)
{ {
a1->data.scenery.door.openFlags |= 0x01; a1->data.scenery.door.openFlags |= 0x01;
return 0; return 0;
} }
// 0x49CB04 // 0x49CB04
int _set_door_state_closed(Object* a1, Object* a2) static int _set_door_state_closed(Object* a1, Object* a2)
{ {
a1->data.scenery.door.openFlags &= ~0x01; a1->data.scenery.door.openFlags &= ~0x01;
return 0; return 0;
} }
// 0x49CB14 // 0x49CB14
int _check_door_state(Object* a1, Object* a2) static int _check_door_state(Object* a1, Object* a2)
{ {
if ((a1->data.scenery.door.openFlags & 0x01) == 0) { if ((a1->data.scenery.door.openFlags & 0x01) == 0) {
a1->flags &= ~OBJECT_OPEN_DOOR; a1->flags &= ~OBJECT_OPEN_DOOR;
@ -1869,7 +1890,7 @@ int _obj_use_skill_on(Object* source, Object* target, int skill)
} }
// 0x49D178 // 0x49D178
bool _obj_is_lockable(Object* obj) static bool _obj_is_lockable(Object* obj)
{ {
Proto* proto; Proto* proto;
@ -1956,7 +1977,7 @@ int objectUnlock(Object* object)
} }
// 0x49D294 // 0x49D294
bool _obj_is_openable(Object* obj) static bool _obj_is_openable(Object* obj)
{ {
Proto* proto; Proto* proto;
@ -1991,7 +2012,7 @@ int objectIsOpen(Object* object)
} }
// 0x49D2F4 // 0x49D2F4
int objectOpenClose(Object* obj) static int objectOpenClose(Object* obj)
{ {
if (obj == NULL) { if (obj == NULL) {
return -1; return -1;
@ -2052,7 +2073,7 @@ int objectClose(Object* obj)
} }
// 0x49D410 // 0x49D410
bool objectIsJammed(Object* obj) static bool objectIsJammed(Object* obj)
{ {
if (!_obj_is_lockable(obj)) { if (!_obj_is_lockable(obj)) {
return false; return false;

View File

@ -1,11 +1,8 @@
#ifndef PROTOTYPE_INSTANCES_H #ifndef PROTOTYPE_INSTANCES_H
#define PROTOTYPE_INSTANCES_H #define PROTOTYPE_INSTANCES_H
#include "message.h"
#include "obj_types.h" #include "obj_types.h"
extern MessageListItem stru_49A990;
int _obj_sid(Object* object, int* sidPtr); int _obj_sid(Object* object, int* sidPtr);
int _obj_new_sid(Object* object, int* sidPtr); int _obj_new_sid(Object* object, int* sidPtr);
int _obj_new_sid_inst(Object* obj, int a2, int a3); int _obj_new_sid_inst(Object* obj, int a2, int a3);
@ -14,42 +11,23 @@ int _obj_look_at_func(Object* a1, Object* a2, void (*a3)(char* string));
int _obj_examine(Object* a1, Object* a2); int _obj_examine(Object* a1, Object* a2);
int _obj_examine_func(Object* critter, Object* target, void (*fn)(char* string)); int _obj_examine_func(Object* critter, Object* target, void (*fn)(char* string));
int _obj_pickup(Object* critter, Object* item); int _obj_pickup(Object* critter, Object* item);
int _obj_remove_from_inven(Object* critter, Object* item);
int _obj_drop(Object* a1, Object* a2); int _obj_drop(Object* a1, Object* a2);
int _obj_destroy(Object* obj); int _obj_destroy(Object* obj);
int _obj_use_book(Object* item_obj);
int _obj_use_flare(Object* critter_obj, Object* item_obj);
int _obj_use_radio(Object* item_obj);
int _obj_use_explosive(Object* explosive);
int _obj_use_power_on_car(Object* ammo);
int _obj_use_misc_item(Object* item_obj);
int _protinst_use_item(Object* a1, Object* a2); int _protinst_use_item(Object* a1, Object* a2);
int _protinstTestDroppedExplosive(Object* a1);
int _obj_use_item(Object* a1, Object* a2); int _obj_use_item(Object* a1, Object* a2);
int _protinst_default_use_item(Object* a1, Object* a2, Object* item);
int _protinst_use_item_on(Object* a1, Object* a2, Object* item); int _protinst_use_item_on(Object* a1, Object* a2, Object* item);
int _obj_use_item_on(Object* a1, Object* a2, Object* a3); int _obj_use_item_on(Object* a1, Object* a2, Object* a3);
int _check_scenery_ap_cost(Object* obj, Object* a2); int _check_scenery_ap_cost(Object* obj, Object* a2);
int _obj_use(Object* a1, Object* a2); int _obj_use(Object* a1, Object* a2);
int useLadderDown(Object* a1, Object* ladder, int a3);
int useLadderUp(Object* a1, Object* ladder, int a3);
int useStairs(Object* a1, Object* stairs, int a3);
int _set_door_state_open(Object* a1, Object* a2);
int _set_door_state_closed(Object* a1, Object* a2);
int _check_door_state(Object* a1, Object* a2);
int _obj_use_door(Object* a1, Object* a2, int a3); int _obj_use_door(Object* a1, Object* a2, int a3);
int _obj_use_container(Object* critter, Object* item); int _obj_use_container(Object* critter, Object* item);
int _obj_use_skill_on(Object* a1, Object* a2, int skill); int _obj_use_skill_on(Object* a1, Object* a2, int skill);
bool _obj_is_lockable(Object* obj);
bool objectIsLocked(Object* obj); bool objectIsLocked(Object* obj);
int objectLock(Object* obj); int objectLock(Object* obj);
int objectUnlock(Object* obj); int objectUnlock(Object* obj);
bool _obj_is_openable(Object* obj);
int objectIsOpen(Object* obj); int objectIsOpen(Object* obj);
int objectOpenClose(Object* obj);
int objectOpen(Object* obj); int objectOpen(Object* obj);
int objectClose(Object* obj); int objectClose(Object* obj);
bool objectIsJammed(Object* obj);
int objectJamLock(Object* obj); int objectJamLock(Object* obj);
int objectUnjamLock(Object* obj); int objectUnjamLock(Object* obj);
int objectUnjamAll(); int objectUnjamAll();