-
Notifications
You must be signed in to change notification settings - Fork 0
/
object.h
119 lines (90 loc) · 3.09 KB
/
object.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*------------------------------------------------------------------
object.h: Model Data, Object, and Object-List managment struct & functions
XINVADERS 3D - 3d Shoot'em up
Copyright (C) 2000 Don Llopis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------*/
#ifndef OBJECT_HEADER
#define OBJECT_HEADER
typedef struct MODELSTRUCT MODEL;
typedef struct OBJECTSTRUCT OBJECT;
typedef struct OBJLISTSTRUCT OBJLIST;
typedef void (*PFV1) ( OBJECT * );
typedef void (*PFV2) ( OBJECT *, MATRIX4 );
/*------------------------------------------------------------------
* MODEL:
* Model data management Struct & Funtions
*
------------------------------------------------------------------*/
struct MODELSTRUCT
{
float **vertex;
int **edge;
int **poly;
int num_vertex;
int num_polys;
};
/*------------------------------------------------------------------
* OBJECT:
* Object Managment Struct & Funtions
*
------------------------------------------------------------------*/
struct OBJECTSTRUCT
{
int active;
long frame;
long delay;
long max_frame;
int zone;
int zheight;
int vpos;
float radius;
float radius_squared;
double rot;
VECTOR4 pos;
VECTOR4 old_pos;
VECTOR4 dir;
VECTOR4 thrust;
PFV1 actionfn;
PFV2 drawfn;
MODEL *model;
OBJECT *next;
OBJECT *prev;
};
extern OBJECT * Object_new ( void );
extern void Object_delete ( OBJECT * );
extern void Object_init ( OBJECT * );
extern void Object_set_actionfn ( OBJECT *, PFV1 );
extern void Object_set_drawfn ( OBJECT *, PFV2 );
extern void Object_set_model ( OBJECT *, MODEL * );
extern void Object_set_pos ( OBJECT *, VECTOR4 );
extern void Object_get_pos ( OBJECT *, VECTOR4 );
extern void Object_set_dir ( OBJECT *, VECTOR4 );
extern void Object_get_dir ( OBJECT *, VECTOR4 );
extern void Object_draw ( OBJECT * );
/*------------------------------------------------------------------
* OBJLIST:
* gobject list managment struct & routines
*
------------------------------------------------------------------*/
struct OBJLISTSTRUCT
{
int obj_count;
OBJECT *head;
OBJECT *tail;
};
extern void Objlist_clear ( OBJLIST * );
extern void Objlist_add ( OBJLIST *, OBJECT * );
extern void Objlist_del ( OBJLIST *, OBJECT * );
extern int Objlist_count ( OBJLIST * );
#endif