Files
Cesarus85--ringfall-mjolnir-vr/source/effects/effects.c
T

358 lines
8.4 KiB
C

/*
EFFECTS.C
symbols in this file:
0008ACC0 0050:
_effects_initialize (0000)
0008AD10 0020:
_effects_initialize_for_new_map (0000)
0008AD30 0020:
_effects_dispose_from_old_map (0000)
0008AD50 0020:
_effects_dispose (0000)
0008AD70 0050:
_code_0008ad70 (0000)
0008ADC0 00c0:
_effect_delete (0000)
0008AE80 0100:
_effects_stop_on_first_person_weapon (0000)
0008AF80 0080:
_effects_information_get (0000)
0008B000 0010:
_effects_disconnect_from_structure_bsp (0000)
0008B010 0030:
_code_0008b010 (0000)
0008B040 0020:
_code_0008b040 (0000)
0008B060 0080:
_code_0008b060 (0000)
0008B0E0 0080:
_code_0008b0e0 (0000)
0008B160 0080:
_code_0008b160 (0000)
0008B1E0 0020:
_code_0008b1e0 (0000)
0008B200 0090:
_code_0008b200 (0000)
0008B290 0080:
_code_0008b290 (0000)
0008B310 00e0:
_code_0008b310 (0000)
0008B3F0 0050:
_code_0008b3f0 (0000)
0008B440 00b0:
_code_0008b440 (0000)
0008B4F0 0010:
_real_local_random (0000)
0008B500 0020:
_local_random_direction3d (0000)
0008B520 0090:
_effect_stop (0000)
0008B5B0 00c0:
_effects_reconnect_to_structure_bsp (0000)
0008B670 01f0:
_dangerous_effects_near_player (0000)
0008B860 00e0:
_code_0008b860 (0000)
0008B940 0160:
_code_0008b940 (0000)
0008BAA0 00b0:
_code_0008baa0 (0000)
0008BB50 00b0:
_code_0008bb50 (0000)
0008BC00 0760:
_code_0008bc00 (0000)
0008C360 03e0:
_code_0008c360 (0000)
0008C740 00b0:
_effects_start_on_first_person_weapon (0000)
0008C7F0 0190:
_code_0008c7f0 (0000)
0008C980 0250:
_code_0008c980 (0000)
0008CBD0 00b0:
_code_0008cbd0 (0000)
0008CC80 0530:
_code_0008cc80 (0000)
0008D1B0 00f0:
_effect_new_looping (0000)
0008D2A0 0210:
_effect_new_from_object (0000)
0008D4B0 02a0:
_effect_new_attached_from_markers (0000)
0008D750 0240:
_effect_new_unattached_from_markers (0000)
0008D990 0090:
_effects_update (0000)
0025A424 000f:
??_C@_0P@FBPJPKBN@effects_update?$AA@ (0000)
0025A434 0021:
??_C@_0CB@HMDGHGFM@couldn?8t?5allocate?5effect?5globals@ (0000)
0025A458 0010:
??_C@_0BA@DBNCDKDD@effect?5location?$AA@ (0000)
0025A468 0007:
??_C@_06HOPIODND@effect?$AA@ (0000)
0025A470 0021:
??_C@_0CB@KCIIEPGL@c?3?2halo?2SOURCE?2effects?2effects?4c@ (0000)
0025A494 0015:
??_C@_0BF@IACBPFOC@location_datum_index?$AA@ (0000)
0025A4AC 0013:
??_C@_0BD@IEHBIGCF@effect_index?$CB?$DNNONE?$AA@ (0000)
0025A4C0 004e:
??_C@_0EO@BKJIDONM@cannot?5create?5objects?0?5lights?0?5o@ (0000)
0025A510 000f:
??_C@_0P@HFFHMHLJ@?$CGeffect?9?$DOcolor?$AA@ (0000)
0025A520 000f:
??_C@_0P@MDAIOCAG@count_delta?$DO?$DN0?$AA@ (0000)
0025A530 001c:
??_C@_0BM@HEALEJFA@effect?5?$CFs?5has?5a?5bad?5part?5?$CFs?$AA@ (0000)
0025A54C 0021:
??_C@_0CB@LPDGPLO@effect?9?$DOlocal_player_index?$DN?$DNNONE@ (0000)
0025A570 0009:
??_C@_08FLABJHKG@?$CGforward?$AA@ (0000)
0025A57C 002c:
??_C@_0CM@MOGGIEEI@?$CGmarker_list?9?$DOforwards?$FLeffect_ma@ (0000)
0025A5A8 0041:
??_C@_0EB@KCJAOKOI@effect_marker_index?$DO?$DN0?5?$CG?$CG?5effect@ (0000)
0025A5EC 001b:
??_C@_0BL@MLPMKFCB@created?5?$CFsviolent?5?$CFs?5on?5?$CFs?$AA@ (0000)
0025A608 0004:
??_C@_03LNLHGKOH@non?$AA@ (0000)
0025A60C 0018:
??_C@_0BI@JECIIDID@scale_b?5?$CFf?5not?5in?5?$FL0?01?$FN?$AA@ (0000)
0025A624 0018:
??_C@_0BI@HOKOFOOB@scale_a?5?$CFf?5not?5in?5?$FL0?01?$FN?$AA@ (0000)
0025A63C 0010:
??_C@_0BA@BNLBDOE@marker_forwards?$AA@ (0000)
0025A64C 000e:
??_C@_0O@BFOEKDJK@marker_points?$AA@ (0000)
0025A65C 000f:
??_C@_0P@DBOLECLB@marker_count?$DO0?$AA@ (0000)
0025A670 0047:
??_C@_0EH@MLPNNEFC@?$CBtranslational_velocity?5?$HM?$HM?5valid@ (0000)
002DD1A0 0600:
_effects_corpse_nonviolent (0000)
0043D584 0005:
_bss_0043d584 (0000)
_debug_effects_nonviolent (0004)
*/
/* ---------- headers */
#define local_random_direction3d local_random_direction3d_inline
#include "cseries/cseries.h"
#include "cseries/errors.h"
#include "memory/data.h"
#include "math/real_math.h"
#include "objects/objects.h"
#include "saved games/game_state.h"
#include "scenario/scenario.h"
#undef local_random_direction3d
/* ---------- constants */
enum effect_datum_flags
{
_effect_stopped_bit = 3,
_effect_invisible_bit = 4,
};
/* ---------- macros */
/* ---------- structures */
struct effect_datum_header
{
short identifier;
word flags;
};
struct effects_information
{
short effect_count;
short location_count;
short active_effect_count;
};
struct effect_datum
{
struct effect_datum_header header;
byte _unknown04[0x0C];
struct location location;
byte _unknown18[0x24];
long object_index;
byte _unknown40[0x1C];
long location_datum_indices[32];
byte _unknownDC[0x20];
};
struct effect_location_datum
{
short identifier;
short node_designator;
long next_instance_location_index;
real_matrix4x3 matrix;
};
typedef char effect_datum_header_size_assert[
sizeof(struct effect_datum_header) == 0x4 ? 1 : -1];
typedef char effects_information_size_assert[
sizeof(struct effects_information) == 0x6 ? 1 : -1];
typedef char effect_datum_location_offset_assert[
offsetof(struct effect_datum, location) == 0x10 ? 1 : -1];
typedef char effect_datum_object_index_offset_assert[
offsetof(struct effect_datum, object_index) == 0x3C ? 1 : -1];
typedef char effect_datum_location_indices_offset_assert[
offsetof(struct effect_datum, location_datum_indices) == 0x5C ? 1 : -1];
typedef char effect_datum_size_assert[
sizeof(struct effect_datum) == 0xFC ? 1 : -1];
typedef char effect_location_datum_matrix_offset_assert[
offsetof(struct effect_location_datum, matrix) == 0x08 ? 1 : -1];
typedef char effect_location_datum_size_assert[
sizeof(struct effect_location_datum) == 0x3C ? 1 : -1];
/* ---------- prototypes */
struct effect_location_datum *effect_location_get_next_instance(
struct effect_datum const *effect,
long *location_datum_index,
short camera_mode);
/* ---------- globals */
extern struct data_array *effect_data;
extern struct data_array *effect_location_data;
/* ---------- public code */
void effects_initialize(
void)
{
effect_data = game_state_data_new("effect", 0x100, 0xFC);
effect_location_data = game_state_data_new("effect location", 0x200, 0x3C);
if (!effect_data || !effect_location_data)
error(_error_immediate, "couldn't allocate effect globals");
return;
}
void effects_initialize_for_new_map(
void)
{
data_make_valid(effect_data);
data_make_valid(effect_location_data);
return;
}
void effects_dispose_from_old_map(
void)
{
data_make_invalid(effect_data);
data_make_invalid(effect_location_data);
return;
}
void effects_dispose(
void)
{
if (effect_data)
effect_data = NULL;
if (effect_location_data)
effect_location_data = NULL;
return;
}
void effects_information_get(
struct effects_information *information)
{
long effect_index;
information->effect_count = effect_data->actual_count;
information->location_count = effect_location_data->actual_count;
information->active_effect_count = 0;
for (effect_index = data_next_index(effect_data, NONE);
effect_index != NONE;
effect_index = data_next_index(effect_data, effect_index))
{
short flags = ((struct effect_datum_header *)datum_get(
effect_data,
effect_index))->flags;
if ((flags & (1u << _effect_stopped_bit)) == 0 &&
(flags & (1u << _effect_invisible_bit)) == 0)
{
information->active_effect_count++;
}
}
return;
}
void effects_disconnect_from_structure_bsp(
void)
{
return;
}
void effects_reconnect_to_structure_bsp(
void)
{
long effect_index;
for (effect_index = data_next_index(effect_data, NONE);
effect_index != NONE;
effect_index = data_next_index(effect_data, effect_index))
{
struct effect_datum *effect =
(struct effect_datum *)datum_get(effect_data, effect_index);
if (effect->object_index == NONE)
{
long location_datum_index = effect->location_datum_indices[0];
struct effect_location_datum *instance = NULL;
if (location_datum_index != NONE)
{
instance = (struct effect_location_datum *)datum_get(
effect_location_data,
location_datum_index);
location_datum_index = instance->next_instance_location_index;
if (instance->node_designator != NONE &&
(instance->node_designator & (1u << 15)) != 0)
{
instance = effect_location_get_next_instance(
effect,
&location_datum_index,
0);
}
}
if (instance)
{
scenario_location_from_point(
&effect->location,
&instance->matrix.position);
}
else
{
effect_delete(effect_index);
}
}
}
return;
}
real_vector3d *local_random_direction3d(
real_vector3d *direction)
{
return seed_random_direction3d(
get_global_local_random_seed_address(),
direction);
}
/* ---------- private code */