home *** CD-ROM | disk | FTP | other *** search
- /*
- ** MacWT -- a 3d game engine for the Macintosh
- ** © 1995, Bill Hayden and Nikol Software
- ** Free for non-commercial use - address questions to the e-mail address below
- **
- ** Mail: afn28988@freenet.ufl.edu (Bill Hayden)
- ** MacWT FTP site: ftp.circa.ufl.edu/pub/software/ufmug/mirrors/LocalSW/Hayden/
- ** WWW Page: http://grove.ufl.edu:80/~nikolsw
- **
- ** All of the above addresses are due to changes sometime in 1996, so stay tuned
- **
- ** based on wt, by Chris Laurel
- **
- ** 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.
- */
-
-
- #ifndef FIXED_H_
- #include "fixed.h"
- #endif
-
- #ifndef TEXTURE_H_
- #include "texture.h"
- #endif
-
- #ifndef TABLE_H_
- #include "table.h"
- #endif
-
- #ifndef LIST_H_
- #include "list.h"
- #endif
-
- typedef struct {
- fixed x, y;
- fixed tx, ty, proj; /* transformed coordinates */
- } Vertex;
-
-
- #define Region WT_Region
-
- typedef struct {
- fixed floor, ceiling;
- Texture *floor_tex, *ceiling_tex;
- } Region;
-
-
- typedef struct {
- Vertex *vertex1, *vertex2;
- Texture *surface_texture;
- Region *front, *back;
- fixed xphase, yphase;
- fixed xscale, yscale;
- Boolean sky;
- Boolean opaque;
- } Wall;
-
-
- #define NO_WALL -1
-
- #define MAX_VERTICES 2000
- #define MAX_WALLS 2000
- #define MAX_REGIONS 2000
- #define MAX_TEXTURES 200
- #define MAX_OBJECTS 2000
-
- typedef struct {
- Table *vertices;
- Table *walls;
- Table *regions;
- Table *textures;
- List *objects;
- } World;
-
- typedef struct {
- short mass;
- short xsize;
- short ysize;
- short height;
- short gravity;
- short drag;
- } PhysicsData;
-
- typedef PhysicsData **PhysicsModel;
-
-
- #define WORLD_VERTEX(w, v) ((TABLE_ELEMENTS((w)->vertices, Vertex))[v])
- #define WORLD_TEXTURE(w, t) ((TABLE_ELEMENTS((w)->textures, Texture *))[t])
- #define WORLD_REGION(w, r) ((TABLE_ELEMENTS((w)->regions, Region))[r])
- #define WORLD_WALL(w, x) ((TABLE_ELEMENTS((w)->walls, Wall))[x])
-
- extern World *new_world(void);
- extern int add_texture(World *w, Texture *tex);
- extern int add_wall(World *w, Wall *wall);
- extern int add_vertex(World *w, Vertex *v);
- extern int add_region(World *w, Region *r);
-
- extern void update_wall_scale(World *w, int wall_num,
- fixed xscale, fixed yscale);
- extern void update_wall_phase(World *w, int wall_num,
- fixed xphase, fixed yphase);
- extern void update_wall_height(World *w, int wall_num,
- fixed floor_front, fixed floor_back,
- fixed ceiling_front, fixed ceiling_back);
- extern Region *in_region(World *w, fixed x, fixed y);
-