72- (void)setupForPlayer:(
PlayerEntity*)p1 digram:(NSString*)digramString
86 int pointscheme[6] = { 1, 1, 0, 0, 1, 1 };
88 pointscheme[0] = (ps >> 3) & 1;
89 pointscheme[1] = (ps >> 2) & 1;
90 pointscheme[2] = (ps >> 1) & 1;
91 pointscheme[3] = ps & 1;
92 pointscheme[4] = (ps >> 2) & 1;
93 pointscheme[5] = (ps >> 3) & 1;
95 GLfloat c1[4] = { 1.0, 1.0, 1.0, 1.0 };
96 GLfloat c2[4] = { 1.0, 0.0, 0.0, 1.0 };
106 max_size = 0.90 + 0.50 * ((r0 & 0x38) + ((r1 & 0x38) >> 3)) / 63.0;
115 while (((col1 == 7) || (col1 == 0)) && ((col2 == 7) || (col2 == 0)))
122 c1[0] = (GLfloat)(col1 & 1);
123 c1[1] = (GLfloat)((col1 >> 1) & 1);
124 c1[2] = (GLfloat)((col1 >> 2) & 1);
125 c2[0] = (GLfloat)(col2 & 1);
126 c2[1] = (GLfloat)((col2 >> 1) & 1);
127 c2[2] = (GLfloat)((col2 >> 2) & 1);
129 c1[0] = 0.5 + 0.1 * c2[1];
130 c1[1] = 0.5 + 0.1 * c2[2];
134 c1[0] = 1.0 - 0.1 * c2[1];
135 c1[1] = 1.0 - 0.1 * c2[2];
139 c2[0] = 0.5 + 0.1 * c1[2];
140 c2[1] = 0.5 + 0.1 * c1[0];
144 c2[0] = 1.0 - 0.1 * c1[2];
145 c2[1] = 1.0 - 0.1 * c1[0];
164 for (i = 0; i < 4; i++) {
169 for (i = 0; i < 6; i++) {
171 if (pointscheme[i] == 0)
173 if (pointscheme[i] == 1)
177 for (i = 0; i < 4; i++) {
200 options:kOOTextureDefaultOptions | kOOTextureNoShrink
202 lodBias:kOOTextureDefaultLODBias];
362- (void)drawTrumble:(
double)z
373 GLfloat wd = 96 *
size;
374 GLfloat ht = 96 *
size;
375 OOGL(glShadeModel(GL_SMOOTH));
376 OOGL(glEnable(GL_TEXTURE_2D));
390 glTexCoord2f(0.25, 0.5);
391 glVertex2f(0.0, -0.5 * ht);
394 glTexCoord2f(0.0, 0.5);
395 glVertex2f(-0.5 * wd, -0.5 * ht);
398 glTexCoord2f(0.0, 0.0);
399 glVertex2f(-0.5 * wd, 0.5 * ht);
402 glTexCoord2f(0.25, 0.0);
403 glVertex2f(0.0, 0.5 * ht);
406 glTexCoord2f(0.5, 0.0);
407 glVertex2f(0.5 * wd, 0.5 * ht);
410 glTexCoord2f(0.5, 0.5);
411 glVertex2f(0.5 * wd, -0.5 * ht);
417 GLfloat eyeTextureOffset = 0.0;
421 eyeTextureOffset = 0.0;
424 eyeTextureOffset = 0.25;
427 eyeTextureOffset = 0.5;
435 glTexCoord2f(0.5, eyeTextureOffset);
436 glVertex2f(-0.5 * wd, 0.20 * ht);
438 glTexCoord2f(1.0, eyeTextureOffset);
439 glVertex2f(0.5 * wd, 0.20 * ht);
441 glTexCoord2f(1.0, eyeTextureOffset + 0.25);
442 glVertex2f(0.5 * wd, -0.30 * ht);
444 glTexCoord2f(0.5, eyeTextureOffset + 0.25);
445 glVertex2f(-0.5 * wd, -0.30 * ht);
451 GLfloat mouthTextureOffset = 0.0;
454 mouthTextureOffset = 0.500;
458 mouthTextureOffset = 0.625;
461 mouthTextureOffset = 0.750;
464 mouthTextureOffset = 0.875;
472 glTexCoord2f(0.0, mouthTextureOffset);
473 glVertex2f(-0.25 * wd, -0.10 * ht);
475 glTexCoord2f(0.25, mouthTextureOffset);
476 glVertex2f(0.25 * wd, -0.10 * ht);
478 glTexCoord2f(0.25, mouthTextureOffset + 0.125);
479 glVertex2f(0.25 * wd, -0.35 * ht);
481 glTexCoord2f(0.0, mouthTextureOffset + 0.125);
482 glVertex2f(-0.25 * wd, -0.35 * ht);
487 OOGL(glDisable(GL_TEXTURE_2D));
490- (void)updateTrumble:(
double)delta_t
518 GLfloat wd = 0.5 * 96 *
size;
519 GLfloat ht = 0.5 * 96 *
size;
521 GLfloat bumpx = 320 * 1.5 - wd;
522 GLfloat bumpy = 240 * 1.5 - ht;
568 discomfort += delta_t * (temp - 0.33) * (temp - 0.33) * 0.05;
578 float mostYummy = 0.0;
580 NSUInteger i, n_pods = [
cargopods count];
581 for (i = 0; i < n_pods; i++) {
584 float yumminess = (1.0 +
randf()) * [[
UNIVERSE commodityMarket] trumbleOpinionForGood:cargo_type];
585 if (yumminess > mostYummy) {
586 selectedCargopod = cargopod;
587 mostYummy = yumminess;
590 if (selectedCargopod) {
594 trumbleAppetiteAccumulator +=
hunger;
599 if (trumbleAppetiteAccumulator > 10.0) {
601 NSString* ms = [
NSString stringWithFormat:DESC(@"trumbles-eat-@"),
604 [UNIVERSE addMessage:ms forCount:4.5];
605 [
cargopods removeObject:selectedCargopod];
606 trumbleAppetiteAccumulator -= 10.0;
909 [
NSString stringWithCharacters:digram
912 [
NSNumber numberWithFloat:hunger], @"hunger",
913 [
NSNumber numberWithFloat:discomfort], @"discomfort",
914 [
NSNumber numberWithFloat:size], @"size",
915 [
NSNumber numberWithFloat:growth_rate], @"growth_rate",
916 [
NSNumber numberWithFloat:rotation], @"rotation",
917 [
NSNumber numberWithFloat:rotational_velocity], @"rotational_velocity",
918 StringFromPoint(position), @"position",
919 StringFromPoint(movement), @"movement",
923- (void)setFromDictionary:(NSDictionary*)dict
925 NSString* digramString = (NSString*)[dict objectForKey:
@"digram"];
927 hunger = [[
dict objectForKey:@"hunger"] floatValue];
929 size = [[
dict objectForKey:@"size"] floatValue];
931 rotation = [[
dict objectForKey:@"rotation"] floatValue];
id textureWithName:inFolder:options:anisotropy:lodBias:(NSString *name,[inFolder] NSString *directory,[options] OOTextureFlags options,[anisotropy] GLfloat anisotropy,[lodBias] GLfloat lodBias)