Descent3/manage/genericpage.h
2024-04-16 12:56:40 -06:00

69 lines
2.8 KiB
C

#ifndef GENERICPAGE_H
#define GENERICPAGE_H
#include "manage.h"
#include "CFILE.H"
#include "pstypes.h"
#include "objinfo.h"
#include "robotfirestruct.h"
typedef struct {
object_info objinfo_struct;
anim_elem anim[NUM_MOVEMENT_CLASSES];
otype_wb_info static_wb[MAX_WBS_PER_OBJ];
t_ai_info ai_info;
char image_name[PAGENAME_LEN];
char med_image_name[PAGENAME_LEN];
char lo_image_name[PAGENAME_LEN];
char sound_name[MAX_OBJ_SOUNDS][PAGENAME_LEN];
char ai_sound_name[MAX_AI_SOUNDS][PAGENAME_LEN];
char weapon_name[MAX_WBS_PER_OBJ][MAX_WB_GUNPOINTS][PAGENAME_LEN];
char fire_sound_name[MAX_WBS_PER_OBJ][MAX_WB_FIRING_MASKS][PAGENAME_LEN];
char anim_sound_name[NUM_MOVEMENT_CLASSES][NUM_ANIMS_PER_CLASS][PAGENAME_LEN];
char dspew_name[MAX_DSPEW_TYPES][PAGENAME_LEN];
} mngs_generic_page;
// Generic page functions
//---------------------------------------------------------------
// Given an open file pointer and a generic_page struct, writes that genericpage out
void mng_WriteGenericPage(CFILE *outfile, mngs_generic_page *genericpage);
// Reads a generic page from an open file. Returns 0 on error.
int mng_ReadGenericPage(CFILE *infile, mngs_generic_page *genericpage);
// Given an open file pointer and a generic_page struct, writes that genericpage out
void mng_WriteNewGenericPage(CFILE *outfile, mngs_generic_page *genericpage);
// Reads a generic page from an open file. Returns 0 on error.
int mng_ReadNewGenericPage(CFILE *infile, mngs_generic_page *genericpage);
// Reads in the genericpage named "name" into genericpage struct
// Returns 0 on error or couldn't find, else 1 if all is good
int mng_FindSpecificGenericPage(char *name, mngs_generic_page *genericpage, int offset = 0);
// Given a generic page, allocs a generic and calls AssignGenericPageToGeneric to actually
// load model and values. Rturns generic handle on success, -1 if fail
int mng_SetAndLoadGeneric(mngs_generic_page *genericpage, CFILE *infile = NULL);
// Given a genericpage and a generic handle, attempts to make generic n correspond to
// to the genericpage.
// Returns 1 on success, 0 otherwise
int mng_AssignGenericPageToObjInfo(mngs_generic_page *genericpage, int n, CFILE *infile = NULL);
// Copies values from a Generic into a generic_page
void mng_AssignObjInfoToGenericPage(int n, mngs_generic_page *genericpage);
// Reads in a generic page from the local table file, superseding any generic
// already in RAM with that same name
void mng_LoadLocalGenericPage(CFILE *);
// Reads in a page off the net
void mng_LoadNetGenericPage(CFILE *, bool overlay = false);
// First searches through the object index to see if the object is already
// loaded. If not, searches in the table file and loads it.
// Returns index of object found, -1 if not
int mng_GetGuaranteedGenericPage(char *name, CFILE *infile);
#endif