75- (void) setupForPlayer:(
PlayerEntity*) p1 digram:(NSString*) digramString
89 int pointscheme[6] = { 1, 1, 0, 0, 1, 1};
91 pointscheme[0] = (ps >> 3) & 1;
92 pointscheme[1] = (ps >> 2) & 1;
93 pointscheme[2] = (ps >> 1) & 1;
94 pointscheme[3] = ps & 1;
95 pointscheme[4] = (ps >> 2) & 1;
96 pointscheme[5] = (ps >> 3) & 1;
98 GLfloat c1[4] = { 1.0, 1.0, 1.0, 1.0};
99 GLfloat c2[4] = { 1.0, 0.0, 0.0, 1.0};
109 max_size = 0.90 + 0.50 * ((r0 & 0x38) + ((r1 & 0x38) >> 3)) / 63.0;
118 while (((col1 == 7)||(col1 == 0)) && ((col2 == 7)||(col2 == 0)))
125 c1[0] = (GLfloat)(col1 & 1);
126 c1[1] = (GLfloat)((col1 >> 1) & 1);
127 c1[2] = (GLfloat)((col1 >> 2) & 1);
128 c2[0] = (GLfloat)(col2 & 1);
129 c2[1] = (GLfloat)((col2 >> 1) & 1);
130 c2[2] = (GLfloat)((col2 >> 2) & 1);
133 c1[0] = 0.5 + 0.1 * c2[1]; c1[1] = 0.5 + 0.1 * c2[2]; c1[2] = 0.5;
137 c1[0] = 1.0 - 0.1 * c2[1]; c1[1] = 1.0 - 0.1 * c2[2]; c1[2] = 0.9;
141 c2[0] = 0.5 + 0.1 * c1[2]; c2[1] = 0.5 + 0.1 * c1[0]; c2[2] = 0.5;
145 c2[0] = 1.0 - 0.1 * c1[2]; c2[1] = 1.0 - 0.1 * c1[0]; c2[2] = 0.9;
163 for (i = 0; i < 4; i++)
169 for (i = 0; i < 6; i++)
172 if (pointscheme[i] == 0)
174 if (pointscheme[i] == 1)
178 for (i = 0; i < 4; i++)
202 options:kOOTextureDefaultOptions | kOOTextureNoShrink
204 lodBias:kOOTextureDefaultLODBias];
371- (void) drawTrumble:(
double) z
382 GLfloat wd = 96 *
size;
383 GLfloat ht = 96 *
size;
384 OOGL(glShadeModel(GL_SMOOTH));
385 OOGL(glEnable(GL_TEXTURE_2D));
399 glTexCoord2f( 0.25, 0.5);
400 glVertex2f( 0.0, -0.5 * ht);
403 glTexCoord2f( 0.0, 0.5);
404 glVertex2f( -0.5 * wd, -0.5 * ht);
407 glTexCoord2f( 0.0, 0.0);
408 glVertex2f( -0.5 * wd, 0.5 * ht);
411 glTexCoord2f( 0.25, 0.0);
412 glVertex2f( 0.0, 0.5 * ht);
415 glTexCoord2f( 0.5, 0.0);
416 glVertex2f( 0.5 * wd, 0.5 * ht);
419 glTexCoord2f( 0.5, 0.5);
420 glVertex2f( 0.5 * wd, -0.5 * ht);
426 GLfloat eyeTextureOffset = 0.0;
431 eyeTextureOffset = 0.0;
break;
433 eyeTextureOffset = 0.25;
break;
435 eyeTextureOffset = 0.5;
break;
442 glTexCoord2f( 0.5, eyeTextureOffset);
443 glVertex2f( -0.5 * wd, 0.20 * ht);
445 glTexCoord2f( 1.0, eyeTextureOffset);
446 glVertex2f( 0.5 * wd, 0.20 * ht);
448 glTexCoord2f( 1.0, eyeTextureOffset + 0.25);
449 glVertex2f( 0.5 * wd, -0.30 * ht);
451 glTexCoord2f( 0.5, eyeTextureOffset + 0.25);
452 glVertex2f( -0.5 * wd, -0.30 * ht);
458 GLfloat mouthTextureOffset = 0.0;
462 mouthTextureOffset = 0.500;
break;
465 mouthTextureOffset = 0.625;
break;
467 mouthTextureOffset = 0.750;
break;
469 mouthTextureOffset = 0.875;
break;
476 glTexCoord2f( 0.0, mouthTextureOffset);
477 glVertex2f( -0.25 * wd, -0.10 * ht);
479 glTexCoord2f( 0.25, mouthTextureOffset);
480 glVertex2f( 0.25 * wd, -0.10 * ht);
482 glTexCoord2f( 0.25, mouthTextureOffset + 0.125);
483 glVertex2f( 0.25 * wd, -0.35 * ht);
485 glTexCoord2f( 0.0, mouthTextureOffset + 0.125);
486 glVertex2f( -0.25 * wd, -0.35 * ht);
491 OOGL(glDisable(GL_TEXTURE_2D));
494- (void) updateTrumble:(
double) delta_t
523 GLfloat wd = 0.5 * 96 *
size;
524 GLfloat ht = 0.5 * 96 *
size;
526 GLfloat bumpx = 320 * 1.5 - wd;
527 GLfloat bumpy = 240 * 1.5 - ht;
578 discomfort += delta_t * (temp - 0.33) * (temp - 0.33) * 0.05;
589 float mostYummy = 0.0;
591 NSUInteger i, n_pods = [
cargopods count];
592 for (i = 0 ; i < n_pods; i++)
596 float yumminess = (1.0 +
randf()) * [[
UNIVERSE commodityMarket] trumbleOpinionForGood:cargo_type];
597 if (yumminess > mostYummy)
599 selectedCargopod = cargopod;
600 mostYummy = yumminess;
603 if (selectedCargopod)
608 trumbleAppetiteAccumulator +=
hunger;
613 if (trumbleAppetiteAccumulator > 10.0)
616 NSString* ms = [
NSString stringWithFormat:DESC(@"trumbles-eat-@"),
619 [UNIVERSE addMessage: ms forCount: 4.5];
620 [
cargopods removeObject:selectedCargopod];
621 trumbleAppetiteAccumulator -= 10.0;
945 [
NSString stringWithCharacters:digram length:2], @"digram",
946 [
NSNumber numberWithFloat:hunger], @"hunger",
947 [
NSNumber numberWithFloat:discomfort], @"discomfort",
948 [
NSNumber numberWithFloat:size], @"size",
949 [
NSNumber numberWithFloat:growth_rate], @"growth_rate",
950 [
NSNumber numberWithFloat:rotation], @"rotation",
951 [
NSNumber numberWithFloat:rotational_velocity], @"rotational_velocity",
952 StringFromPoint(position), @"position",
953 StringFromPoint(movement), @"movement",
957- (void) setFromDictionary:(NSDictionary*) dict
959 NSString* digramString = (NSString*)[dict objectForKey:
@"digram"];
961 hunger = [[
dict objectForKey: @"hunger"] floatValue];
963 size = [[
dict objectForKey: @"size"] floatValue];
965 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)