OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
gt2aLogic.h
1/*
2GameSpy GT2 SDK
3GT2Action - sample app
4Dan "Mr. Pants" Schoenblum
5dan@gamespy.com
6
7Copyright 2000 GameSpy Industries, Inc
8
9*/
10
11#ifndef _GT2ALOGIC_H_
12#define _GT2ALOGIC_H_
13
14#include "gt2aServer.h"
15
16#define PLAYER_SPEED 7000 // units/second
17#define PLAYER_TURN_SPEED 0.14 // degrees/millisecond
18#define PLAYER_RADIUS 200
19#define PLAYER_MAX_ASTEROIDS 50
20#define DEATH_TIME 1000
21#define PRESS_TIME 100 // time between presses
22
23#define MAX_OBJECTS 256
24#define ROCKET_RADIUS 250
25#define ROCKET_SPEED 10500
26#define MINE_TIME 30000
27#define MINE_ARM_TIME 1000
28#define MINE_TURN_SPEED 0.36 // degrees/millisecond
29#define MINE_RADIUS 200//141
30#define NUM_ASTEROIDS 50
31#define ASTEROID_TURN_SPEED 0.18
32#define ASTEROID_TURN_RANGE 0.24
33#define ASTEROID_RADIUS 350
34#define ASTEROID_SPEED_MIN 0
35#define ASTEROID_SPEED_MAX 5000
36#define EXPLOSION_RADIUS 900
37#define EXPLOSION_TIME 350
38#define EXPLOSION_DANGER_TIME 250
39#define SPINNER_RADIUS 5000
40#define SPINNER_COORD (SPINNER_RADIUS * 1.414)
41
42typedef enum
43{
44 ObjectRocket,
45 ObjectMine,
46 ObjectAsteroid,
47 ObjectExplosion,
48 NumObjects
49} ObjectType;
50
51typedef void (* Think)
52(
53 struct SObject * self
54);
55
56typedef void (* TouchObject)
57(
58 struct SObject * self,
59 struct SObject * object
60);
61
62typedef void (* Die)
63(
64 struct SObject * self
65);
66
67typedef void (* TouchClient)
68(
69 struct SObject * self,
70 struct Client * client
71);
72
73typedef struct SObject
74{
75 GT2Bool used; // If this slot is in use or not.
76 ObjectType type; // The type of object.
77 int owner; // The client that owns this object, or -1.
78 V2f position; // The object's position.
79 float rotation; // The object's rotation.
80 unsigned long startTime; // The time this object was created.
81 Think think; // This object's think function.
82 TouchObject touchObject; // Called when touching another object.
83 TouchClient touchClient; // Called when touching a client.
84 Die die; // Called when the object dies.
85 int count; // Generic counter.
86 float radius; // This object's radius (for collision).
87 GT2Bool explode; // Explode this object when done thinking.
88 GT2Bool remove; // Remove this object when done thinking.
89
90 float heading; // The direction the object is moving
91 float speed; // The speed of the object
92} SObject;
93
94extern SObject sObjects[MAX_OBJECTS];
95extern int numObjects;
96
97void ObjectsThink
98(
99 unsigned long now,
100 unsigned long diff
101);
102
103void ClientPress
104(
105 int clientIndex,
106 const char * button
107);
108
109void ClientSpawn
110(
111 Client * client
112);
113
114void InitializeLogic
115(
116 void
117);
118
119#endif
@ object
object (unordered set of name/value pairs)
Definition json.hpp:2857
Definition gt2aServer.h:17
Definition gt2aLogic.h:74