Quake II RTX doxygen
1.0 dev
|
|
Go to the documentation of this file.
33 #define _FA(type, name, size) { type, #name, _OFS(name), size }
35 #define _FA(type, name, size) { type, _OFS(name), size }
37 #define _F(type, name) _FA(type, name, 1)
38 #define SZ(name, size) _FA(F_ZSTRING, name, size)
39 #define BA(name, size) _FA(F_BYTE, name, size)
40 #define B(name) BA(name, 1)
41 #define SA(name, size) _FA(F_SHORT, name, size)
42 #define S(name) SA(name, 1)
43 #define IA(name, size) _FA(F_INT, name, size)
44 #define I(name) IA(name, 1)
45 #define FA(name, size) _FA(F_FLOAT, name, size)
46 #define F(name) FA(name, 1)
47 #define L(name) _F(F_LSTRING, name)
48 #define V(name) _F(F_VECTOR, name)
49 #define T(name) _F(F_ITEM, name)
50 #define E(name) _F(F_EDICT, name)
51 #define P(name, type) _FA(F_POINTER, name, type)
130 F(touch_debounce_time),
131 F(pain_debounce_time),
132 F(damage_debounce_time),
133 F(fly_sound_debounce_time),
159 I(groundentity_linkcount),
189 V(moveinfo.start_origin),
190 V(moveinfo.start_angles),
191 V(moveinfo.end_origin),
192 V(moveinfo.end_angles),
194 I(moveinfo.sound_start),
195 I(moveinfo.sound_middle),
196 I(moveinfo.sound_end),
201 F(moveinfo.distance),
207 F(moveinfo.current_speed),
208 F(moveinfo.move_speed),
209 F(moveinfo.next_speed),
210 F(moveinfo.remaining_distance),
211 F(moveinfo.decel_distance),
215 I(monsterinfo.aiflags),
216 I(monsterinfo.nextframe),
217 F(monsterinfo.scale),
230 F(monsterinfo.pausetime),
231 F(monsterinfo.attack_finished),
233 V(monsterinfo.saved_goal),
234 F(monsterinfo.search_time),
235 F(monsterinfo.trail_time),
236 V(monsterinfo.last_sighting),
237 I(monsterinfo.attack_state),
238 I(monsterinfo.lefty),
239 F(monsterinfo.idle_time),
240 I(monsterinfo.linkcount),
242 I(monsterinfo.power_armor_type),
243 I(monsterinfo.power_armor_power),
254 SZ(level_name, MAX_QPATH),
255 SZ(mapname, MAX_QPATH),
256 SZ(nextmap, MAX_QPATH),
261 V(intermission_origin),
262 V(intermission_angle),
267 I(sight_entity_framenum),
269 I(sound_entity_framenum),
271 I(sound2_entity_framenum),
296 SA(ps.pmove.origin, 3),
297 SA(ps.pmove.velocity, 3),
298 B(ps.pmove.pm_flags),
301 SA(ps.pmove.delta_angles, 3),
318 SA(ps.stats, MAX_STATS),
320 SZ(pers.userinfo, MAX_INFO_STRING),
321 SZ(pers.netname, 16),
330 I(pers.selected_item),
331 IA(pers.inventory, MAX_ITEMS),
336 I(pers.max_grenades),
346 I(pers.game_helpchanged),
398 I(invincible_framenum),
399 I(breather_framenum),
415 SZ(helpmessage1, 512),
416 SZ(helpmessage2, 512),
435 if (fwrite(buf, 1, len, f) != len) {
436 gi.error(
"%s: couldn't write %"PRIz
" bytes", __func__, len);
479 static void write_index(FILE *f,
void *p,
size_t size,
void *start,
int max_index)
488 if (p < start || (
byte *)p > (
byte *)start + max_index * size) {
489 gi.error(
"%s: pointer out of range: %p", __func__, p);
492 diff = (
byte *)p - (
byte *)start;
494 gi.error(
"%s: misaligned pointer: %p", __func__, p);
510 if (ptr->
type == type && ptr->
ptr == p) {
516 gi.error(
"%s: unknown pointer: %p", __func__, p);
521 void *p = (
byte *)base + field->
ofs;
524 switch (field->
type) {
529 for (i = 0; i < field->
size; i++) {
534 for (i = 0; i < field->
size; i++) {
539 for (i = 0; i < field->
size; i++) {
569 gi.error(
"%s: unknown field type", __func__);
577 for (field = fields; field->
type; field++) {
584 if (fread(buf, 1, len, f) != len) {
585 gi.error(
"%s: couldn't read %"PRIz
" bytes", __func__, len);
630 if (len < 0 || len > 65536) {
631 gi.error(
"%s: bad length", __func__);
646 if (len < 0 || len >= size) {
647 gi.error(
"%s: bad length", __func__);
661 static void *
read_index(FILE *f,
size_t size,
void *start,
int max_index)
671 if (index < 0 || index > max_index) {
672 gi.error(
"%s: bad index", __func__);
675 p = (
byte *)start + index * size;
690 gi.error(
"%s: bad index", __func__);
694 if (ptr->
type != type) {
695 gi.error(
"%s: type mismatch", __func__);
703 void *p = (
byte *)base + field->
ofs;
706 switch (field->
type) {
711 for (i = 0; i < field->
size; i++) {
716 for (i = 0; i < field->
size; i++) {
721 for (i = 0; i < field->
size; i++) {
751 gi.error(
"%s: unknown field type", __func__);
759 for (field = fields; field->
type; field++) {
766 #define SAVE_MAGIC1 (('1'<<24)|('V'<<16)|('S'<<8)|'S') // "SSV1"
767 #define SAVE_MAGIC2 (('1'<<24)|('V'<<16)|('A'<<8)|'S') // "SAV1"
768 #define SAVE_VERSION 2
792 f = fopen(filename,
"wb");
794 gi.error(
"Couldn't open %s", filename);
817 f = fopen(filename,
"rb");
819 gi.error(
"Couldn't open %s", filename);
824 gi.error(
"Not a save game");
830 gi.error(
"Savegame from an older version");
838 gi.error(
"Savegame has bad maxclients");
842 gi.error(
"Savegame has bad maxentities");
872 f = fopen(filename,
"wb");
874 gi.error(
"Couldn't open %s", filename);
883 for (i = 0; i <
globals.num_edicts; i++) {
923 f = fopen(filename,
"rb");
925 gi.error(
"Couldn't open %s", filename);
934 gi.error(
"Not a save game");
940 gi.error(
"Savegame from an older version");
952 gi.error(
"%s: bad entity number", __func__);
954 if (entnum >=
globals.num_edicts)
955 globals.num_edicts = entnum + 1;
960 ent->s.number = entnum;
963 memset(&ent->area, 0,
sizeof(ent->area));
973 ent->client->pers.connected = qfalse;
977 for (i = 0 ; i <
globals.num_edicts ; i++) {
985 if (strcmp(ent->classname,
"target_crosslevel_target") == 0)
986 ent->nextthink =
level.
time + ent->delay;
989 char *
msg = ent->message;
static void write_int(FILE *f, int v)
static void * read_index(FILE *f, size_t size, void *start, int max_index)
static void write_vector(FILE *f, vec_t *v)
static void write_data(void *buf, size_t len, FILE *f)
static void write_fields(FILE *f, const save_field_t *fields, void *base)
void ReadLevel(const char *filename)
static void write_short(FILE *f, short v)
void WriteGame(const char *filename, qboolean autosave)
static int read_int(FILE *f)
static void write_field(FILE *f, const save_field_t *field, void *base)
const save_ptr_t save_ptrs[]
static const save_field_t clientfields[]
static void write_pointer(FILE *f, void *p, ptr_type_t type)
static void read_field(FILE *f, const save_field_t *field, void *base)
static char * read_string(FILE *f)
static void write_string(FILE *f, char *s)
#define CLOCK_MESSAGE_SIZE
static void read_zstring(FILE *f, char *s, size_t size)
static void write_float(FILE *f, float v)
size_t Q_strlcpy(char *dst, const char *src, size_t size)
static const save_field_t gamefields[]
static const save_field_t entityfields[]
@ P_monsterinfo_checkattack
static void read_vector(FILE *f, vec_t *v)
void ReadGame(const char *filename)
void WriteLevel(const char *filename)
static q_noinline int diff(uint32_t A_u32, uint32_t B_u32)
void func_clock_use(edict_t *self, edict_t *other, edict_t *activator)
static float read_float(FILE *f)
static void write_index(FILE *f, void *p, size_t size, void *start, int max_index)
static void read_data(void *buf, size_t len, FILE *f)
void func_clock_think(edict_t *self)
static int read_short(FILE *f)
void SaveClientData(void)
static const save_field_t levelfields[]
static void * read_pointer(FILE *f, ptr_type_t type)
@ P_monsterinfo_currentmove
static void read_fields(FILE *f, const save_field_t *fields, void *base)