void noFigure::DrawWalking(int x, int y) { // Figurentyp unterscheiden switch(job_) { case JOB_PACKDONKEY: { // Wenn wir warten, ani-step 2 benutzen unsigned ani_step = waiting_for_free_node ? 2 : GAMECLIENT.Interpolate(ASCENT_ANIMATION_STEPS[ascent], current_ev) % 8; // Wenn man wartet, stehend zeichnen, es sei denn man wartet mittem auf dem Weg! if(!waiting_for_free_node || pause_walked_gf) CalcFigurRelative(x, y); // Esel LOADER.GetMapImageN(2000 + ((GetCurMoveDir() + 3) % 6) * 8 + ani_step)->Draw(x, y); // Schatten des Esels LOADER.GetMapImageN(2048 + GetCurMoveDir() % 3)->Draw(x, y, 0, 0, 0, 0, 0, 0, COLOR_SHADOW); } return; case JOB_CHARBURNER: { DrawWalking(x, y, "charburner_bobs", 53); } return; default: { DrawWalkingBobJobs(x, y, job_); } return; } }
void nofWarehouseWorker::Draw(int x, int y) { // Trage ich ne Ware oder nicht? if(carried_ware) DrawWalkingBobCarrier(x, y, carried_ware->type, fat); // // Japaner-Schild-Animation existiert leider nicht --> Römerschild nehmen // DrawWalking(x,y,LOADER.GetBobN("carrier"),(carried_ware->type==GD_SHIELDJAPANESE) ? GD_SHIELDROMANS:carried_ware->type,fat); else DrawWalkingBobJobs(x, y, fat ? JOB_TYPES_COUNT : 0); // DrawWalking(x,y,LOADER.GetBobN("jobs"),0,fat); }
void nofGeologist::Draw(int x, int y) { switch(state) { default: break; case STATE_FIGUREWORK: case STATE_GEOLOGIST_GOTONEXTNODE: case STATE_GOTOFLAG: { // normales Laufen zeichnen DrawWalkingBobJobs(x, y, JOB_GEOLOGIST); } break; case STATE_GEOLOGIST_DIG: { // 1x grab, 1x "spring-grab", 2x grab, 1x "spring-grab", 2x grab, 1x "spring-grab", 4x grab unsigned short i = GAMECLIENT.Interpolate(84, current_ev); unsigned sound = 0, sound_id; if(i < 6) { LOADER.GetImageN("rom_bobs", 324 + i)->Draw(x, y, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(player).color]); if(i == 4) { sound = 1; sound_id = 0; } } else if(i < 16) { LOADER.GetImageN("rom_bobs", 314 + i - 6)->Draw(x, y, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(player).color]); if(i == 14) { sound = 2; sound_id = 1; } } else if(i < 28) { LOADER.GetImageN("rom_bobs", 324 + (i - 16) % 6)->Draw(x, y, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(player).color]); if(i == 20) { sound = 1; sound_id = 2; } else if(i == 26) { sound = 1; sound_id = 3; } } else if(i < 38) { LOADER.GetImageN("rom_bobs", 314 + i - 28)->Draw(x, y, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(player).color]); if(i == 36) { sound = 2; sound_id = 4; } } else if(i < 50) { LOADER.GetImageN("rom_bobs", 324 + (i - 38) % 6)->Draw(x, y, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(player).color]); if(i == 42) { sound = 1; sound_id = 5; } else if(i == 48) { sound = 1; sound_id = 6; } } else if(i < 60) { LOADER.GetImageN("rom_bobs", 314 + i - 50)->Draw(x, y, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(player).color]); if(i == 58) { sound = 2; sound_id = 7; } } else { LOADER.GetImageN("rom_bobs", 324 + (i - 60) % 6)->Draw(x, y, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(player).color]); if(i == 64) { sound = 1; sound_id = 8; } else if(i == 70) { sound = 1; sound_id = 9; } else if(i == 76) { sound = 1; sound_id = 10; } else if(i == 82) { sound = 1; sound_id = 11; } } if(sound) SOUNDMANAGER.PlayNOSound((sound == 1) ? 81 : 56, this, sound_id); } break; case STATE_GEOLOGIST_CHEER: { unsigned short i = GAMECLIENT.Interpolate(16, current_ev); if(i < 7) { LOADER.GetImageN("rom_bobs", 357 + i)->Draw(x, y, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(player).color]); } else { unsigned char ids[9] = { 1, 0, 1, 2, 1, 0, 1, 2, 1}; LOADER.GetImageN("rom_bobs", 361 + ids[i - 7])->Draw(x, y, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(player).color]); } if(i == 4)SOUNDMANAGER.PlayNOSound(107, this, 12); //yippy } break; } /*char number[256]; sprintf(number,"%u",obj_id); NormalFont->Draw(x,y,number,0,0xFFFF0000);*/ }
void nofBuilder::Draw(int x, int y) { switch(state) { case STATE_FIGUREWORK: { DrawWalkingBobJobs(x, y, JOB_BUILDER); } break; case STATE_BUILDFREEWALK: case STATE_WAITINGFREEWALK: { // Interpolieren und Door-Point von Baustelle draufaddieren x += (GAMECLIENT.Interpolate(rel_x, next_rel_x, current_ev) + building_site->GetDoorPointX()); y += (GAMECLIENT.Interpolate(rel_y, next_rel_y, current_ev) + building_site->GetDoorPointY()); LOADER.bob_jobs_cache[building_site->GetNation()][JOB_BUILDER][GetCurMoveDir()][GAMECLIENT.Interpolate(12, current_ev) % 8].draw(x, y, COLOR_WHITE, COLORS[gwg->GetPlayer(player).color]); // LOADER.GetBobN("jobs")->Draw(23,dir,false,GAMECLIENT.Interpolate(12,current_ev)%8,x,y,COLORS[gwg->GetPlayer(player).color]); // DrawShadow(x,y,GAMECLIENT.Interpolate(12,current_ev)%8,dir); /*LOADER.GetBobN("jobs")->Draw(23,dir,false,GAMECLIENT.Interpolate((state==STATE_WAITINGFREEWALK)?8:5,current_ev),x,y,COLORS[gwg->GetPlayer(player).color]); DrawShadow(x,y,GAMECLIENT.Interpolate(16,current_ev)%8);*/ } break; case STATE_BUILD: { unsigned index = GAMECLIENT.Interpolate(28, current_ev); // Je nachdem, wie weit der Bauarbeiter links bzw rechts oder in der Mitte steht, so wird auch die Animation angezeigt if(rel_x < -5) { // von links mit Hammer if(index < 12 || index > 19) { // Bauarbeiter steht LOADER.GetImageN("rom_bobs", 353 + index % 4)->Draw(x + building_site->GetDoorPointX() + rel_x, y + building_site->GetDoorPointY() + rel_y, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(building_site->GetPlayer()).color]); if(index % 4 == 2) SOUNDMANAGER.PlayNOSound(78, this, index, 160 - rand() % 60); } else { // er kniet LOADER.GetImageN("rom_bobs", 283 + index % 4)->Draw(x + building_site->GetDoorPointX() + rel_x, y + building_site->GetDoorPointY() + rel_y, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(building_site->GetPlayer()).color]); if(index % 4 == 2) SOUNDMANAGER.PlayNOSound(72, this, index, 160 - rand() % 60); } } else if(rel_x < 5) { // in der Mitte mit "Händen" LOADER.GetImageN("rom_bobs", 287 + (index / 2) % 4)->Draw(x + building_site->GetDoorPointX() + rel_x, y + building_site->GetDoorPointY() + rel_y, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(building_site->GetPlayer()).color]); } else { // von rechts mit Hammer if(index < 12 || index > 19) { // Bauarbeiter steht LOADER.GetImageN("rom_bobs", 279 + index % 4)->Draw(x + building_site->GetDoorPointX() + rel_x, y + building_site->GetDoorPointY() + rel_y, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(building_site->GetPlayer()).color]); if(index % 4 == 2) SOUNDMANAGER.PlayNOSound(78, this, index, 160 - rand() % 60); } else { // er kniet LOADER.GetImageN("rom_bobs", 283 + index % 4)->Draw(x + building_site->GetDoorPointX() + rel_x, y + building_site->GetDoorPointY() + rel_y, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(building_site->GetPlayer()).color]); if(index % 4 == 2) SOUNDMANAGER.PlayNOSound(72, this, index, 160 - rand() % 60); } } } break; } //char number[256]; //sprintf(number,"%u",obj_id); //NormalFont->Draw(x,y,number,0,0xFFFF0000); }
void nofPlaner::Draw(int x, int y) { switch(state) { case STATE_FIGUREWORK: case STATE_WALKING: { DrawWalkingBobJobs(x, y, JOB_PLANER); // DrawWalking(x,y,LOADER.GetBobN("jobs"),JOB_CONSTS[JOB_PLANER].jobs_bob_id,false); } break; case STATE_PLANING: { // 41 /// Animation des Planierers unsigned now_id = GAMECLIENT.Interpolate(69, current_ev); // spezielle Animation am Ende const unsigned ANIMATION[21] = { 273, 273, 273, 273, 273, 274, 274, 275, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 277, 277, 278 }; if(now_id < 20) LOADER.GetImageN("rom_bobs", 253 + now_id)->Draw(x, y, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(building_site->GetPlayer()).color]); else if(now_id < 41) LOADER.GetImageN("rom_bobs", ANIMATION[now_id - 20])->Draw(x, y, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(building_site->GetPlayer()).color]); else if(now_id < 55) LOADER.GetImageN("rom_bobs", 253 + now_id - 41)->Draw(x, y, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(building_site->GetPlayer()).color]); else LOADER.GetImageN("rom_bobs", 253 + now_id - 55)->Draw(x, y, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(building_site->GetPlayer()).color]); // Schaufel-Sound if(now_id == 5 || now_id == 46 || now_id == 60) SOUNDMANAGER.PlayNOSound(76, this, now_id, 200); // Tret-Sound else if(now_id == 20 || now_id == 28) SOUNDMANAGER.PlayNOSound(66, this, now_id, 200); } break; } }
/** * * * @author OLiver */ void nofCarrier::Draw(int x, int y) { // Unterscheiden, um was für eine Art von Träger es sich handelt switch(ct) { case CT_NORMAL: { if(state == CARRS_WAITFORWARE || (waiting_for_free_node && !pause_walked_gf && !carried_ware)) { bool animation = false; // Ist es schon Zeit für eine Animation? unsigned current_gf = GAMECLIENT.GetGFNumber(); if(current_gf >= next_animation) { // Animationstype bestimmen unsigned animation_id = next_animation % 4; // <Silvesteregg> // day of year, 0-365, accuracy about 1/4 day int doy = (TIME.CurrentTime() % 31556925) / 86400; // last hours of last or first day of year if ((doy > 364) || (doy < 1)) { animation_id = next_animation % 5; } // </Silvesteregg> // Ist die Animation schon vorbei? if (((animation_id < 4) && (current_gf >= next_animation + ANIMATION_FRAME_LENGTHS[fat ? 1 : 0][animation_id]*FRAME_GF)) || ((animation_id == 4) && (current_gf >= next_animation + 32 * 3))) { // Neuen nächsten Animationszeitpunkt bestimmen SetNewAnimationMoment(); } else { animation = true; if (animation_id < 4) { // Nein, dann Animation abspielen LOADER.GetImageN("rom_bobs", ANIMATION[fat ? 1 : 0][animation_id][(current_gf - next_animation) / FRAME_GF]) ->Draw(x, y, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(player)->color]); } else if (animation_id == 4) // Silvesteregg { glArchivItem_Bitmap* bmp = LOADER.GetImageN("firework", (current_gf - next_animation) / 3 + 1); if (bmp) { bmp->Draw(x - 26, y - 104, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(player)->color]); } else { SetNewAnimationMoment(); animation = false; } } } } if(!animation) { Loader::bob_jobs_cache[gwg->GetPlayer(player)->nation][fat ? JOB_TYPES_COUNT : 0][GetCurMoveDir()][2].draw(x, y, COLOR_WHITE, COLORS[gwg->GetPlayer(player)->color]); } else // Steht und wartet (ohne Ware) // LOADER.GetBobN("jobs")->Draw(0,dir,fat,2,x,y,COLORS[gwg->GetPlayer(player)->color]); DrawShadow(x, y, 0, GetCurMoveDir()); } else if(state == CARRS_WAITFORWARESPACE || (waiting_for_free_node && !pause_walked_gf && carried_ware)) { // Steht und wartet (mit Ware) Loader::carrier_cache[carried_ware->type][GetCurMoveDir()][2][fat].draw(x, y, COLOR_WHITE, COLORS[gwg->GetPlayer(player)->color]); // Japaner-Schild-Animation existiert leider nicht --> Römerschild nehmen // LOADER.GetBobN("carrier")->Draw((carried_ware->type==GD_SHIELDJAPANESE)?GD_SHIELDROMANS:carried_ware->type, // dir,fat,2,x,y,COLORS[gwg->GetPlayer(player)->color]); // DrawShadow(x,y,0,dir); } else { // Läuft normal mit oder ohne Ware if(carried_ware) DrawWalkingBobCarrier(x, y, carried_ware->type, fat); // DrawWalking(x,y,LOADER.GetBobN("carrier"),(carried_ware->type==GD_SHIELDJAPANESE)?GD_SHIELDROMANS:carried_ware->type,fat); else DrawWalkingBobJobs(x, y, fat ? JOB_TYPES_COUNT : 0); } } break; case CT_DONKEY: { if(state == CARRS_WAITFORWARE || (waiting_for_free_node && !pause_walked_gf && !carried_ware)) { // Steht und wartet (ohne Ware) // Esel Loader::donkey_cache[GetCurMoveDir()][0].draw(x, y); } else if(state == CARRS_WAITFORWARESPACE || (waiting_for_free_node && !pause_walked_gf && carried_ware)) { //// Steht und wartet (mit Ware) //// Japaner-Schild-Animation existiert leider nicht --> Römerschild nehmen // Esel Loader::donkey_cache[GetCurMoveDir()][0].draw(x, y); // Ware im Korb zeichnen LOADER.GetMapImageN(2350 + carried_ware->type)->Draw(x + WARE_POS_DONKEY[GetCurMoveDir() * 16], y + WARE_POS_DONKEY[GetCurMoveDir() * 16 + 1]); } else { // Wenn wir warten auf ein freies Plätzchen, müssen wir den stehend zeichnen! // Wenn event = 0, dann sind wir mittem auf dem Weg angehalten! unsigned ani_step = waiting_for_free_node ? 2 : GAMECLIENT.Interpolate(ASCENT_ANIMATION_STEPS[ascent], current_ev) % 8; CalcFigurRelative(x, y); // Läuft normal mit oder ohne Ware // Esel Loader::donkey_cache[GetCurMoveDir()][ani_step].draw(x, y); if(carried_ware) { // Ware im Korb zeichnen LOADER.GetMapImageN(2350 + carried_ware->type)->Draw(x + WARE_POS_DONKEY[GetCurMoveDir() * 16 + ani_step * 2], y + WARE_POS_DONKEY[GetCurMoveDir() * 16 + ani_step * 2 + 1]); } } } break; case CT_BOAT: { if(state == CARRS_FIGUREWORK) { // Beim normalen Laufen Träger mit Boot über den Schultern zeichnen DrawWalkingBobCarrier(x, y, GD_BOAT, fat); // DrawWalking(x,y,LOADER.GetBobN("carrier"),GD_BOAT,fat); } else if(state == CARRS_WAITFORWARE || (waiting_for_free_node && !pause_walked_gf && !carried_ware)) { Loader::boat_cache[GetCurMoveDir()][0].draw(x, y, 0xFFFFFFFF, COLORS[gwg->GetPlayer(player)->color]); } else if(state == CARRS_WAITFORWARESPACE || (waiting_for_free_node && !pause_walked_gf && carried_ware)) { Loader::boat_cache[GetCurMoveDir()][0].draw(x, y, 0xFFFFFFFF, COLORS[gwg->GetPlayer(player)->color]); // Ware im Boot zeichnen LOADER.GetMapImageN(2350 + carried_ware->type)->Draw(x + WARE_POS_BOAT[GetCurMoveDir() * 2], y + WARE_POS_BOAT[GetCurMoveDir() * 2 + 1]); } else { // Wenn wir warten auf ein freies Plätzchen, müssen wir den (fest)stehend zeichnen! // Wenn event = 0, dann sind wir mittem auf dem Weg angehalten! unsigned ani_step = waiting_for_free_node ? 2 : GAMECLIENT.Interpolate(ASCENT_ANIMATION_STEPS[ascent], current_ev) % 8; CalcFigurRelative(x, y); // ruderndes Boot zeichnen Loader::boat_cache[GetCurMoveDir()][ani_step].draw(x, y, 0xFFFFFFFF, COLORS[gwg->GetPlayer(player)->color]); // Läuft normal mit oder ohne Ware if(carried_ware) // Ware im Boot zeichnen LOADER.GetMapImageN(2350 + carried_ware->type)->Draw(x + WARE_POS_BOAT[GetCurMoveDir() * 2], y + WARE_POS_BOAT[GetCurMoveDir() * 2 + 1]); // Sound ggf. abspielen if(ani_step == 2) SOUNDMANAGER.PlayNOSound(84, this, 0); last_id = ani_step; } } break; } }