Oolite 1.91.0.7646-241128-10e222e
Loading...
Searching...
No Matches
OOTrumble.h
Go to the documentation of this file.
1/*
2
3OOTrumble.h
4
5Implements cute, fuzzy trumbles.
6
7Oolite
8Copyright (C) 2004-2013 Giles C Williams and contributors
9
10This program is free software; you can redistribute it and/or
11modify it under the terms of the GNU General Public License
12as published by the Free Software Foundation; either version 2
13of the License, or (at your option) any later version.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23MA 02110-1301, USA.
24
25*/
26
27#import <Foundation/Foundation.h>
28#import "OOOpenGL.h"
29
30
32
33#define TRUMBLE_MAX_ROTATION 15.0
34#define TRUMBLE_MAX_ROTATIONAL_VELOCITY 5.0
35
36#define TRUMBLE_GROWTH_RATE 0.01
37
51
59
68
69
70@interface OOTrumble: NSObject
71{
72@private
73 PlayerEntity *player; // owning entity (not retained)
74 //
75 unichar digram[2]; // seed for pseudo-randomly setting up Trumble (pair of characters)
76 //
77 GLfloat colorBase[4]; // color of Trumble
78 GLfloat colorPoint1[4]; // color of Trumble (variation 1)
79 GLfloat colorPoint2[4]; // color of Trumble (variation 2)
80 GLfloat colorEyes[4]; // color of Trumble (eye color)
81 GLfloat *pointColor[6]; // pointscheme
82 //
83 GLfloat hunger; // behaviour modifier 0.0 (satiated) to 1.0 (starving)
84 GLfloat discomfort; // behaviour modifier 0.0 (very happy) to 1.0 (extremely uncomfortable)
85 //
86 GLfloat size; // 0.0 -> max_size
87 GLfloat max_size; // 0.90 -> 1.25
88 GLfloat growth_rate; // diff to size per sec.
89 //
90 GLfloat rotation; // CW rotation in radians (starts at 0.0)
91 GLfloat rotational_velocity; // +r (radians/sec)
92 //
93 NSPoint position; // x, y onscreen relative to center of screen
94 NSPoint movement; // +x, +y (screen units / sec)
95 //
96 NSPoint eye_position; // current position of eyes relative to their starting position
97 NSPoint mouth_position; // current position of eyes relative to their starting position
98 //
99 double animationTime; // set to 0.0 at start of current animation
100 double animationDuration; // set to 0.0 at start of current animation
101 //
102 enum trumble_animation animation; // current animation sequence
103 enum trumble_animation nextAnimation; // next animation sequence
104 //
105 int animationStage; // sub-sequence within animation
106 //
107 enum trumble_mouth mouthFrame; // which mouth position - determines what part of the texture to display
108 enum trumble_eyes eyeFrame; // which eye position - determines what part of the texture to display
109 //
111 //
113 //
115}
116
117- (id) initForPlayer:(PlayerEntity *)p1;
118- (id) initForPlayer:(PlayerEntity *)p1 digram:(NSString*) digramString;
119
120- (void) setupForPlayer:(PlayerEntity *)p1 digram:(NSString*) digramString;
121
122- (void) spawnFrom:(OOTrumble *)parentTrumble;
123
124- (void) calcGrowthRate;
125
126- (unichar *) digram;
127- (NSPoint) position;
128- (NSPoint) movement;
129- (GLfloat) rotation;
130- (GLfloat) size;
131- (GLfloat) hunger;
132- (GLfloat) discomfort;
133
134// AI methods here
135- (void) actionIdle;
136- (void) actionBlink;
137- (void) actionSnarl;
138- (void) actionProot;
139- (void) actionShudder;
140- (void) actionStoned;
141- (void) actionPop;
142- (void) actionSleep;
143- (void) actionSpawn;
144
145- (void) randomizeMotionX;
146- (void) randomizeMotionY;
147
148- (void) drawTrumble:(double) z;
149- (void) updateTrumble:(double) delta_t;
150
151- (void) updateIdle:(double) delta_t;
152- (void) updateBlink:(double) delta_t;
153- (void) updateSnarl:(double) delta_t;
154- (void) updateProot:(double) delta_t;
155- (void) updateShudder:(double) delta_t;
156- (void) updateStoned:(double) delta_t;
157- (void) updatePop:(double) delta_t;
158- (void) updateSleep:(double) delta_t;
159- (void) updateSpawn:(double) delta_t;
160
161- (NSDictionary *)dictionary;
162- (void) setFromDictionary:(NSDictionary *)dict;
163
164@end
trumble_mouth
Definition OOTrumble.h:61
@ TRUMBLE_MOUTH_NONE
Definition OOTrumble.h:62
@ TRUMBLE_MOUTH_GROWL
Definition OOTrumble.h:64
@ TRUMBLE_MOUTH_NORMAL
Definition OOTrumble.h:66
@ TRUMBLE_MOUTH_POUT
Definition OOTrumble.h:63
@ TRUMBLE_MOUTH_SNARL
Definition OOTrumble.h:65
trumble_animation
Definition OOTrumble.h:39
@ TRUMBLE_ANIM_SLEEP
Definition OOTrumble.h:48
@ TRUMBLE_ANIM_IDLE
Definition OOTrumble.h:41
@ TRUMBLE_ANIM_SHUDDER
Definition OOTrumble.h:45
@ TRUMBLE_ANIM_PROOT
Definition OOTrumble.h:44
@ TRUMBLE_ANIM_STONED
Definition OOTrumble.h:46
@ TRUMBLE_ANIM_SNARL
Definition OOTrumble.h:43
@ TRUMBLE_ANIM_NONE
Definition OOTrumble.h:40
@ TRUMBLE_ANIM_DIE
Definition OOTrumble.h:49
@ TRUMBLE_ANIM_BLINK
Definition OOTrumble.h:42
@ TRUMBLE_ANIM_SPAWN
Definition OOTrumble.h:47
trumble_eyes
Definition OOTrumble.h:53
@ TRUMBLE_EYES_OPEN
Definition OOTrumble.h:55
@ TRUMBLE_EYES_NONE
Definition OOTrumble.h:54
@ TRUMBLE_EYES_WIDE
Definition OOTrumble.h:57
@ TRUMBLE_EYES_SHUT
Definition OOTrumble.h:56
Definition AI.h:38
NSPoint mouth_position
Definition OOTrumble.h:97
enum trumble_animation animation
Definition OOTrumble.h:102
GLfloat discomfort
Definition OOTrumble.h:84
NSPoint position
Definition OOTrumble.h:93
GLfloat rotation
Definition OOTrumble.h:90
GLfloat colorBase[4]
Definition OOTrumble.h:77
GLfloat size
Definition OOTrumble.h:86
GLfloat colorPoint1[4]
Definition OOTrumble.h:78
enum trumble_eyes eyeFrame
Definition OOTrumble.h:108
int animationStage
Definition OOTrumble.h:105
NSPoint movement
Definition OOTrumble.h:94
GLfloat colorEyes[4]
Definition OOTrumble.h:80
GLfloat colorPoint2[4]
Definition OOTrumble.h:79
OOTexture * texture
Definition OOTrumble.h:110
GLfloat rotational_velocity
Definition OOTrumble.h:91
BOOL readyToSpawn
Definition OOTrumble.h:114
GLfloat saved_float2
Definition OOTrumble.h:112
GLfloat max_size
Definition OOTrumble.h:87
enum trumble_mouth mouthFrame
Definition OOTrumble.h:107
GLfloat * pointColor[6]
Definition OOTrumble.h:81
GLfloat growth_rate
Definition OOTrumble.h:88
double animationDuration
Definition OOTrumble.h:100
GLfloat saved_float1
Definition OOTrumble.h:112
PlayerEntity * player
Definition OOTrumble.h:73
GLfloat hunger
Definition OOTrumble.h:83
unichar digram[2]
Definition OOTrumble.h:75
enum trumble_animation nextAnimation
Definition OOTrumble.h:103
double animationTime
Definition OOTrumble.h:99
NSPoint eye_position
Definition OOTrumble.h:96
voidpf void uLong size
Definition ioapi.h:134