void DrawPlayScreen (void) { int i,j,p,m; unsigned temp; VW_FadeOut (); temp = bufferofs; CA_CacheGrChunk (STATUSBARPIC); for (i=0;i<3;i++) { bufferofs = screenloc[i]; DrawPlayBorder (); VWB_DrawPic (0,200-STATUSLINES,STATUSBARPIC); } bufferofs = temp; UNCACHEGRCHUNK (STATUSBARPIC); DrawFace (); DrawHealth (); DrawLives (); DrawLevel (); DrawAmmo (); DrawKeys (); DrawWeapon (); DrawScore (); }
void TB_SaveSelect::DrawProfile(int x, int y, int index) { Profile *p = &fProfiles[index]; const int w = fCoords.w - 33; int sidewd = sprites[SPR_SAVESELECTOR_SIDES].w; int repeatwd = w - (sidewd * 2); int frame = (index == fCurSel) ? 0 : 1; draw_sprite(x, y, SPR_SAVESELECTOR_SIDES, frame, LEFT); draw_sprite_repeating_x(x+sidewd, y, SPR_SAVESELECTOR_MIDDLE, frame, repeatwd); draw_sprite(x+sidewd+repeatwd, y, SPR_SAVESELECTOR_SIDES, frame, RIGHT); y += 4; const int FONT_SPACING = 5; if (fHaveProfile[index]) { const char *stage = map_get_stage_name(p->stage); font_draw(x+8, y-1, stage, FONT_SPACING); // draw health. DrawHealth(x+w, y, p); } else if (fCurSel == index) { const char *str = "available"; int fx = (w / 2) - (GetFontWidth(str, FONT_SPACING) / 2); font_draw(x+fx, y-1, str, FONT_SPACING); } }
void AGameHUD::DrawHUD() { Super::DrawHUD(); DrawHealth(); DrawResources(); DrawSelect(); }
// TODO void Game::DrawGraphics() { //graphics.BeginFrame(); std::map<std::pair<int, int>, Entity*>* entitites = level->getEntities(); DrawBackground(); for (std::map<std::pair<int, int>, Entity*>::iterator i = entitites->begin(); i != entitites->end(); i++) { Entity* entity = i->second; Spikes* spikes = dynamic_cast<Spikes*>(entity); if (spikes != NULL && level->inScene(i->first.second, i->first.first)) { spikes->AnimateBackground(&graphics); } else { //i->second->Animate(NULL); } } if (DEBUG) { graphics.DrawCircle(prince->getMidX(), prince->getMidY(), 5, 255, 255, 255); } if (DEBUG) { graphics.DrawCircle(prince->getX(), prince->getY(), 5, 255, 255, 255); } for (std::map<std::pair<int, int>, Entity*>::iterator i = entitites->begin(); i != entitites->end(); i++) { if (i->second == NULL) { continue; } // TODO: should not happen check load entities if (i->second->getType() == spikeT || i->second->getType() == platformT) { continue; } if (level->inScene(i->first.second, i->first.first)) { i->second->Animate(&graphics); } else { i->second->Animate(NULL); } } prince->Animate(&graphics); DrawForeground(); for (std::map<std::pair<int, int>, Entity*>::iterator i = entitites->begin(); i != entitites->end(); i++) { Entity* entity = i->second; Spikes* spikes = dynamic_cast<Spikes*>(entity); if (spikes != NULL && level->inScene(i->first.second, i->first.first)) { spikes->AnimateForeground(&graphics); } else { //i->second->Animate(NULL); } } DrawHealth(); //graphics.EndFrame(); }
// Draw player's score, health etc. static void DrawPlayerStatus( HUD *hud, const PlayerData *data, const TActor *p, const int flags, const Rect2i r) { if (p != NULL) { DrawObjectiveCompass( hud->device, Vec2iFull2Real(p->Pos), r, hud->showExit); } Vec2i pos = Vec2iNew(5, 5); FontOpts opts = FontOptsNew(); if (flags & HUDFLAGS_PLACE_RIGHT) { opts.HAlign = ALIGN_END; } if (flags & HUDFLAGS_PLACE_BOTTOM) { opts.VAlign = ALIGN_END; pos.y += BOTTOM_PADDING; } opts.Area = gGraphicsDevice.cachedConfig.Res; opts.Pad = pos; FontStrOpt(data->name, Vec2iZero(), opts); const int rowHeight = 1 + FontH(); pos.y += rowHeight; char s[50]; if (IsScoreNeeded(gCampaign.Entry.Mode)) { if (ConfigGetBool(&gConfig, "Game.Ammo")) { // Display money instead of ammo sprintf(s, "Cash: $%d", data->score); } else { sprintf(s, "Score: %d", data->score); } } else { s[0] = 0; } if (p) { // Score/money opts.Pad = pos; FontStrOpt(s, Vec2iZero(), opts); // Health pos.y += rowHeight; DrawHealth(hud->device, p, pos, opts.HAlign, opts.VAlign); // Lives pos.y += rowHeight; DrawLives(hud->device, data, pos, opts.HAlign, opts.VAlign); // Weapon pos.y += rowHeight + LIVES_ROW_EXTRA_Y; DrawWeaponStatus(hud, p, pos, opts.HAlign, opts.VAlign); } else { opts.Pad = pos; FontStrOpt(s, Vec2iZero(), opts); } if (ConfigGetBool(&gConfig, "Interface.ShowHUDMap") && !(flags & HUDFLAGS_SHARE_SCREEN) && IsAutoMapEnabled(gCampaign.Entry.Mode)) { DrawRadar(hud->device, p, RADAR_SCALE, flags, hud->showExit); } }
void TB_SaveSelect::DrawExtendedInfo() { Profile *p = &fProfiles[fCurSel]; int x, y, s; if (fPicXOffset < 0) { fPicXOffset += 8; set_clip_rect(MSG_X+4, 0, SCREEN_WIDTH, SCREEN_HEIGHT); } // player pic draw_sprite((MSG_X+8) + fPicXOffset, MSG_NORMAL_Y+8, SPR_SELECTOR_ARMS); x = (MSG_X + 12) + fPicXOffset; y = MSG_NORMAL_Y + 12; s = (p->equipmask & EQUIP_MIMIGA_MASK) ? SPR_MYCHAR_MIMIGA : SPR_MYCHAR; draw_sprite(x, y, s, 0, RIGHT); // player gun if (p->curWeapon != WPN_NONE && p->curWeapon != WPN_BLADE) { int spr, frame; GetSpriteForGun(p->curWeapon, 0, &spr, &frame); draw_sprite_at_dp(x + sprites[s].frame[0].dir[RIGHT].actionpoint.x, \ y + sprites[s].frame[0].dir[RIGHT].actionpoint.y, \ spr, frame, RIGHT); } clear_clip_rect(); // whimsical stars if (p->equipmask & EQUIP_WHIMSTAR) { x = MSG_X + 12; for(int i=0;i<3;i++) { static int frames[] = { 1, 0, 2 }; draw_sprite(x, y+20, SPR_WHIMSICAL_STAR, frames[i]); x += 10; } } // WEAPONS: x = MSG_X + 64; y = MSG_NORMAL_Y + 8; // weapon list for(int i=0;i<WPN_COUNT;i++) { if (p->weapons[i].hasWeapon) { draw_sprite(x, y, SPR_ARMSICONS, i); x += 20; } } // xp of current weapon if (p->curWeapon != WPN_NONE) { int xb = MSG_X + 64; int yb = MSG_NORMAL_Y + 26; int level = p->weapons[p->curWeapon].level; int curxp = p->weapons[p->curWeapon].xp; int maxxp = player->weapons[p->curWeapon].max_xp[level]; draw_sprite(xb, yb, SPR_XPLEVELICON); xb += 16; draw_sprite(xb, yb, SPR_WHITENUMBERS, level+1); xb += 8; draw_sprite(xb, yb, SPR_XPBAR); if ((curxp == maxxp) && level == 2) draw_sprite(xb, yb, SPR_XPBAR, 3); // MAX else DrawPercentage(xb, yb, SPR_XPBAR, 1, curxp, maxxp, sprites[SPR_XPBAR].w); } // ITEMS: x = (MSG_X + 64) - 10; y = MSG_NORMAL_Y + 40; // Booster // items list. I generally tried to put the ones that are temporary and indicate a // quantity of stage completion at the front so they'll be more likely to be visible. static int items[] = { ITEM_BOOSTER08, ITEM_BOOSTER20, ITEM_LIFE_POT, ITEM_PUPPY, ITEM_JELLYFISH_JUICE, ITEM_CHARCOAL, ITEM_GUM_BASE, ITEM_EXPLOSIVE, ITEM_SPRINKLER, ITEM_CONTROLLER, ITEM_MA_PIGNON, ITEM_LITTLE_MAN, -1 }; for(int i=0;items[i] != -1;i++) { if (CheckInventoryList(items[i], p->inventory, p->ninventory) != -1) { draw_sprite(x, y, SPR_ITEMIMAGE, items[i]); x += 28; if (x + sprites[SPR_ITEMIMAGE].w > (MSG_X + MSG_W) - 8) break; } } // health DrawHealth((MSG_X+MSG_W) - 4, MSG_NORMAL_Y+8, p); }
void DrawHUD() { player_t * CPlayer = StatusBar->CPlayer; players[consoleplayer].inventorytics = 0; if (hud_althudscale && SCREENWIDTH>640) { hudwidth=SCREENWIDTH/2; if (hud_althudscale == 2) { // Optionally just double the pixels to reduce scaling artifacts. hudheight=SCREENHEIGHT/2; } else { if (WidescreenRatio == 4) { hudheight = hudwidth * 30 / BaseRatioSizes[WidescreenRatio][3]; // BaseRatioSizes is inverted for this mode } else { hudheight = hudwidth * 30 / (48*48/BaseRatioSizes[WidescreenRatio][3]); } } } else { hudwidth=SCREENWIDTH; hudheight=SCREENHEIGHT; } if (!automapactive) { int i; // No HUD in the title level! if (gamestate == GS_TITLELEVEL || !CPlayer) return; if (!deathmatch) DrawStatus(CPlayer, 5, hudheight-50); else { DrawStatus(CPlayer, 5, hudheight-75); DrawFrags(CPlayer, 5, hudheight-70); } DrawHealth(CPlayer, 5, hudheight-45); DrawArmor(CPlayer->mo->FindInventory<ABasicArmor>(), CPlayer->mo->FindInventory<AHexenArmor>(), 5, hudheight-20); i=DrawKeys(CPlayer, hudwidth-4, hudheight-10); i=DrawAmmo(CPlayer, hudwidth-5, i); if (hud_showweapons) DrawWeapons(CPlayer, hudwidth - 5, i); DrawInventory(CPlayer, 144, hudheight-28); if (CPlayer->camera && CPlayer->camera->player) { StatusBar->DrawCrosshair(); } if (idmypos) DrawCoordinates(CPlayer); DrawTime(); DrawLatency(); } else { FString mapname; char printstr[256]; int seconds; int length=8*SmallFont->GetCharWidth('0'); int fonth=SmallFont->GetHeight()+1; int bottom=hudheight-1; if (am_showtotaltime) { seconds = Tics2Seconds(level.totaltime); mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60); DrawHudText(SmallFont, hudcolor_ttim, printstr, hudwidth-length, bottom, FRACUNIT); bottom -= fonth; } if (am_showtime) { if (level.clusterflags&CLUSTER_HUB) { seconds = Tics2Seconds(level.time); mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60); DrawHudText(SmallFont, hudcolor_time, printstr, hudwidth-length, bottom, FRACUNIT); bottom -= fonth; } // Single level time for hubs seconds= Tics2Seconds(level.maptime); mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60); DrawHudText(SmallFont, hudcolor_ltim, printstr, hudwidth-length, bottom, FRACUNIT); } ST_FormatMapName(mapname); screen->DrawText(SmallFont, hudcolor_titl, 1, hudheight-fonth-1, mapname, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE); DrawCoordinates(CPlayer); } }
void BossThink(entity *self) { float dy,dx; if(self->s.y > 20.0f) { self->shown = 0; self->solid = 0; self->s.y -= 1; }else { self->shown = 1; self->solid = 1; DrawHealth(self->health*0.15f, self->maxHealth, 1, 0, 0); if(self->cooldown > 0)self->cooldown--; if(self->state2 ==1) { self->s.x-= 0.5f; if(self->s.x <= -20.0f) { self->s.x = -20.0f; self->state2=2; } } if(self->state2 ==2) { self->s.x+= 0.5f; if(self->s.x >= 20.0f) { self->s.x = 20.0f; self->state2=1; } } if(self->cooldown%5==0 && self->cooldown <= 40) { dy=playerPos.y-self->s.y; dx=playerPos.x-self->s.x; self->v.y=(float)atan2(dy,dx); spawnenemyBullet(self->s.x,self->s.y,self->s.z,self->v.y); spawnenemyBullet(self->s.x,self->s.y,self->s.z,self->v.y+0.8f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,self->v.y-0.8f); } if( self->cooldown <= 200 && self->cooldown>= 115 && self->cooldown%8==0) { dy=playerPos.y-self->s.y; dx=playerPos.x-self->s.x; self->v.y=(float)atan2(dy,dx); spawnenemyBullet(self->s.x,self->s.y,self->s.z,self->v.y); spawnenemyBullet(self->s.x,self->s.y,self->s.z,self->v.y-0.2f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,self->v.y+0.2f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,self->v.y-0.4f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,self->v.y+0.4f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,self->v.y-0.5f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,self->v.y+0.5f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,self->v.y-0.6f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,self->v.y+0.6f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,self->v.y-0.8f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,self->v.y+0.8f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,self->v.y-1.0f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,self->v.y+1.0f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,self->v.y-1.2f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,self->v.y+1.2f); } if( self->cooldown <= 0) { self->cooldown = 195; spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.3f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.5f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.7f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.1f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.9f); } if( self->cooldown == 15) { spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.3f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.5f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.7f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.1f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.9f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.3f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.5f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.7f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.1f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.9f); } if( self->cooldown == 100) { spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.3f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.5f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.7f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.1f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.9f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.3f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.5f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.7f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.1f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.9f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.3f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.5f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.7f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.1f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.9f); } if( self->cooldown == 50) { spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.3f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.5f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.7f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.1f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.9f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.3f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.5f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.7f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.1f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.9f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.3f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.5f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.7f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.1f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.9f); } if( self->cooldown == 90) { spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.2f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.3f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.8f); spawnenemyBullet(self->s.x,self->s.y,self->s.z, 0.0f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.8f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.2f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.4f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.6f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.0f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.8f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.2f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.4f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.6f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.0f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.8f); } if( self->cooldown == 80) { spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.4f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.6f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.8f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.2f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.0f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.4f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.6f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.8f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.2f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-3.0f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.4f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.6f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.8f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.2f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.0f); } if( self->cooldown == 70) { spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.3f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.5f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.7f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.1f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.9f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.3f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.5f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.7f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.1f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.9f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.3f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.5f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.7f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.1f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.9f); } if( self->cooldown == 60) { spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.4f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.6f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.8f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-0.2f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.0f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.4f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.6f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.8f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.2f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-3.0f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.4f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.6f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.8f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-1.2f); spawnenemyBullet(self->s.x,self->s.y,self->s.z,-2.0f); } if(self->bigcooldown > 0)self->bigcooldown--; if(self->state == HIT) { self->bigcooldown = 3; self->state = -1; self->modelColor[0] = 1.0f; self->modelColor[1] = 0.0f; self->modelColor[2] = 0.0f; self->modelColor[3] = 1.0f; } if(self->bigcooldown <= 0) { self->state = -1; self->modelColor[0] = bossColor.x; self->modelColor[1] = bossColor.y; self->modelColor[2] = bossColor.z; self->modelColor[3] = 1.0f; } if(self->health <= 0 || self->s.y <= -40.0f) { spawnExplosion(self->s.x,self->s.y,self->s.z, 1.0f); if(self->health <= 0) score += 5000; freeEntity(self); } } }
/** * * \name Died() * * Died * This function perfoms the process of animation the character's death and restart the level * if you still have lives. * */ void Died (void) { float fangle; long dx,dy; int iangle,curangle,clockwise,counter,change; /* -1 means the player has no weapon */ gamestate.weapon = -1; // take away weapon /* We need another way to play sounds */ SD_PlaySound (PLAYERDEATHSND); // // swing around to face attacker // /* could be a function for this animation like: died_animation() or died_rotated_animation() */ dx = killerobj->x - player->x; dy = player->y - killerobj->y; fangle = atan2(dy,dx); // returns -pi to pi if (fangle<0) fangle = M_PI*2+fangle; iangle = fangle/(M_PI*2)*ANGLES; if (player->angle > iangle) { counter = player->angle - iangle; clockwise = ANGLES-player->angle + iangle; } else { clockwise = iangle - player->angle; counter = player->angle + ANGLES-iangle; } curangle = player->angle; if (clockwise<counter) { // // rotate clockwise // if (curangle>iangle) curangle -= ANGLES; do { change = tics*DEATHROTATE; if (curangle + change > iangle) change = iangle-curangle; curangle += change; player->angle += change; if (player->angle >= ANGLES) player->angle -= ANGLES; ThreeDRefresh (); CalcTics (); } while (curangle != iangle); } else { // // rotate counterclockwise // if (curangle<iangle) curangle += ANGLES; do { change = -tics*DEATHROTATE; if (curangle + change < iangle) change = iangle-curangle; curangle += change; player->angle += change; if (player->angle < 0) player->angle += ANGLES; ThreeDRefresh (); CalcTics (); } while (curangle != iangle); } /* FINISH of rotation animation */ // // fade to red // FinishPaletteShifts (); bufferofs += screenofs; VW_Bar (0,0,viewwidth,viewheight,4); IN_ClearKeysDown (); FizzleFade(bufferofs,displayofs+screenofs,viewwidth,viewheight,70,false); bufferofs -= screenofs; IN_UserInput(100); SD_WaitSoundDone (); if (tedlevel == false) // SO'S YA DON'T GET KILLED WHILE LAUNCHING! gamestate.lives--; if (gamestate.lives > -1) //if the character has lives, set a new level { gamestate.health = 100; gamestate.weapon = gamestate.bestweapon = gamestate.chosenweapon = wp_pistol; gamestate.ammo = STARTAMMO; gamestate.keys = 0; gamestate.attackframe = gamestate.attackcount = gamestate.weaponframe = 0; /* We need to change those Draw function to Draw3D functions. */ DrawKeys (); DrawWeapon (); DrawAmmo (); DrawHealth (); DrawFace (); DrawLives (); } }
void Died (void) { float fangle; long dx,dy; int iangle,curangle,clockwise,counter,change; gamestate.weapon = (weapontype)-1; // take away weapon SD_PlaySound (PLAYERDEATHSND); // // swing around to face attacker // dx = killerobj->x - player->x; dy = player->y - killerobj->y; fangle = atan2((float)dy,(float)dx); // returns -pi to pi // PORT add float cast if (fangle<0) fangle = M_PI*2+fangle; iangle = fangle/(M_PI*2)*ANGLES; if (player->angle > iangle) { counter = player->angle - iangle; clockwise = ANGLES-player->angle + iangle; } else { clockwise = iangle - player->angle; counter = player->angle + ANGLES-iangle; } curangle = player->angle; if (clockwise<counter) { // // rotate clockwise // if (curangle>iangle) curangle -= ANGLES; do { change = tics*DEATHROTATE; if (curangle + change > iangle) change = iangle-curangle; curangle += change; player->angle += change; if (player->angle >= ANGLES) player->angle -= ANGLES; ThreeDRefresh (); CalcTics (); } while (curangle != iangle); } else { // // rotate counterclockwise // if (curangle<iangle) curangle += ANGLES; do { change = -tics*DEATHROTATE; if (curangle + change < iangle) change = iangle-curangle; curangle += change; player->angle += change; if (player->angle < 0) player->angle += ANGLES; ThreeDRefresh (); CalcTics (); } while (curangle != iangle); } // // fade to red // FinishPaletteShifts (); bufferofs += screenofs; VW_Bar (0,0,viewwidth,viewheight,4); IN_ClearKeysDown (); FizzleFade(bufferofs,displayofs+screenofs,viewwidth,viewheight,70,False); bufferofs -= screenofs; IN_UserInput(100); SD_WaitSoundDone (); if (tedlevel == False) // SO'S YA DON'T GET KILLED WHILE LAUNCHING! gamestate.lives--; if (gamestate.lives > -1) { gamestate.health = 100; gamestate.weapon = gamestate.bestweapon = gamestate.chosenweapon = wp_pistol; gamestate.ammo = STARTAMMO; gamestate.keys = 0; gamestate.attackframe = gamestate.attackcount = gamestate.weaponframe = 0; DrawKeys (); DrawWeapon (); DrawAmmo (); DrawHealth (); DrawFace (); DrawLives (); } }
void CheckKeys (void) { ScanCode scan; if (screenfaded || demoplayback) // don't do anything with a faded screen return; scan = LastScan; #ifdef SPEAR // // SECRET CHEAT CODE: TAB-G-F10 // if (Keyboard[sc_Tab] && Keyboard[sc_G] && Keyboard[sc_F10]) { WindowH = 160; if (godmode) { Message ("God mode OFF"); SD_PlaySound (NOBONUSSND); } else { Message ("God mode ON"); SD_PlaySound (ENDBONUS2SND); } IN_Ack (); godmode ^= 1; DrawPlayBorderSides (); IN_ClearKeysDown (); return; } #endif // // SECRET CHEAT CODE: 'MLI' // if (Keyboard[sc_M] && Keyboard[sc_L] && Keyboard[sc_I]) { gamestate.health = 100; gamestate.ammo = 99; gamestate.keys = 3; gamestate.score = 0; gamestate.TimeCount += 42000L; GiveWeapon (wp_chaingun); DrawWeapon (); DrawHealth (); DrawKeys (); DrawAmmo (); DrawScore (); ClearMemory (); CA_CacheGrChunk (STARTFONT + 1); ClearSplitVWB (); Message (STR_CHEATER1 "\n" STR_CHEATER2 "\n\n" STR_CHEATER3 "\n" STR_CHEATER4 "\n" STR_CHEATER5); UNCACHEGRCHUNK (STARTFONT + 1); IN_ClearKeysDown (); IN_Ack (); if (viewsize < 17) DrawPlayBorder (); } // // OPEN UP DEBUG KEYS // #ifdef DEBUGKEYS if (Keyboard[sc_BackSpace] && Keyboard[sc_LShift] && Keyboard[sc_Alt] && param_debugmode) { ClearMemory (); CA_CacheGrChunk (STARTFONT + 1); ClearSplitVWB (); Message ("Debugging keys are\nnow available!"); UNCACHEGRCHUNK (STARTFONT + 1); IN_ClearKeysDown (); IN_Ack (); DrawPlayBorderSides (); DebugOk = 1; } #endif // // TRYING THE KEEN CHEAT CODE! // if (Keyboard[sc_B] && Keyboard[sc_A] && Keyboard[sc_T]) { ClearMemory (); CA_CacheGrChunk (STARTFONT + 1); ClearSplitVWB (); Message ("Commander Keen is also\n" "available from Apogee, but\n" "then, you already know\n" "that - right, Cheatmeister?!"); UNCACHEGRCHUNK (STARTFONT + 1); IN_ClearKeysDown (); IN_Ack (); if (viewsize < 18) DrawPlayBorder (); } // // pause key weirdness can't be checked as a scan code // if(buttonstate[bt_pause]) Paused = true; if(Paused) { int lastoffs = StopMusic(); LatchDrawPic (20 - 4, 80 - 2 * 8, PAUSEDPIC); VH_UpdateScreen(); IN_Ack (); Paused = false; ContinueMusic(lastoffs); if (MousePresent && IN_IsInputGrabbed()) IN_CenterMouse(); // Clear accumulated mouse movement lasttimecount = GetTimeCount(); return; } // // F1-F7/ESC to enter control panel // if ( #ifndef DEBCHECK scan == sc_F10 || #endif scan == sc_F9 || scan == sc_F7 || scan == sc_F8) // pop up quit dialog { short oldmapon = gamestate.mapon; short oldepisode = gamestate.episode; ClearMemory (); ClearSplitVWB (); US_ControlPanel (scan); DrawPlayBorderSides (); SETFONTCOLOR (0, 15); IN_ClearKeysDown (); return; } if ((scan >= sc_F1 && scan <= sc_F9) || scan == sc_Escape || buttonstate[bt_esc]) { int lastoffs = StopMusic (); ClearMemory (); VW_FadeOut (); US_ControlPanel (buttonstate[bt_esc] ? sc_Escape : scan); SETFONTCOLOR (0, 15); IN_ClearKeysDown (); VW_FadeOut(); if(viewsize != 21) DrawPlayScreen (); if (!startgame && !loadedgame) ContinueMusic (lastoffs); if (loadedgame) playstate = ex_abort; lasttimecount = GetTimeCount(); if (MousePresent && IN_IsInputGrabbed()) IN_CenterMouse(); // Clear accumulated mouse movement return; } // // TAB-? debug keys // #ifdef DEBUGKEYS if (Keyboard[sc_Tab] && DebugOk) { CA_CacheGrChunk (STARTFONT); fontnumber = 0; SETFONTCOLOR (0, 15); if (DebugKeys () && viewsize < 20) DrawPlayBorder (); // dont let the blue borders flash if (MousePresent && IN_IsInputGrabbed()) IN_CenterMouse(); // Clear accumulated mouse movement lasttimecount = GetTimeCount(); return; } #endif }
int hogansnewalley(Sprite *Aim, Sprite *Health, Sprite *Background, int rumble, int maxtime, int diff, GameWindow *gwd){ checkbadguys = false; gametime = 0; curalleytime = 200; Ghealth = 3; Grumble = rumble; Gscore = 0; switch(diff){ case 1: resetalleytime = 90; grid = false; Alley1->SetPosition(70, 190); Alley2->SetPosition(260, 190); Alley3->SetPosition(450, 190); break; case 2: resetalleytime = 90; grid = true; //Alley1->SetPosition(70, 190); //Alley2->SetPosition(260, 190); //Alley3->SetPosition(450, 190); break; case 3: resetalleytime = 55; grid = false; Alley1->SetPosition(70, 190); Alley2->SetPosition(260, 190); Alley3->SetPosition(450, 190); break; case 4: resetalleytime = 55; grid = true; break; } alive[0] = false; alive[1] = false; alive[2] = false; good1->LoadImage("/apps/WiiShootingGallery/data/good1.png"); good2->LoadImage("/apps/WiiShootingGallery/data/good2.png"); good3->LoadImage("/apps/WiiShootingGallery/data/good3.png"); bad1->LoadImage("/apps/WiiShootingGallery/data/bad1.png"); bad2->LoadImage("/apps/WiiShootingGallery/data/bad2.png"); bad3->LoadImage("/apps/WiiShootingGallery/data/bad3.png"); quitcheck = false; while(true){//Game Loop WPAD_ScanPads(); if(dontcheck) dontcheck = false; Music(); if(curalleytime >= resetalleytime) resetalley(); Background->Draw(); if(alive[0] == true) Alley1->Draw(); if(alive[1] == true) Alley2->Draw(); if(alive[2] == true) Alley3->Draw(); // Infrared calculation - The X and Y of the wiimote sprite ir_t ir; // The struct for infrared WPAD_IR(WPAD_CHAN_0, &ir); // Let's get our infrared data // Give our sprite the positions and the angle. Aim->SetPosition(ir.sx-WSP_POINTER_CORRECTION_X, ir.sy-WSP_POINTER_CORRECTION_Y); // We use these constants to translate the position correctly to the screen Aim->Move(-((f32)Aim->GetWidth()/2), -((f32)Aim->GetHeight()/2)); // And these to make our image appear at the center of this position. Aim->SetRotation(ir.angle/2); // Set angle/2 to translate correctly Aim->Draw(); DrawHealth(Health, Ghealth); if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_PLUS){ InMenu(gwd, false, Ghealth, Gscore); dontcheck = true; if(Ghealth > 3) Ghealth = 3; } if(quitcheck == true) break; if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_HOME) homemenu(gwd); if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_B){ if(!dontcheck) HCheckForHit(Aim); } if(hrumblecounter == 7){ WPAD_Rumble(WPAD_CHAN_0, 0); hrumblecounter = 0; } if(hrumblecounter != 0) hrumblecounter++; if(gametime > maxtime) break; if(maxtime > 0) gametime++; curalleytime++; if(Ghealth <= 0) break; if(shutdown == true) SYS_ResetSystem(SYS_POWEROFF, 0, 0); gwd->Flush(); }//End Game Loop WPAD_Rumble(WPAD_CHAN_0, 0); return Gscore; }
void DrawHUD() { player_t * CPlayer = StatusBar->CPlayer; // [BB] The player may not have a body while connecting. if ( CPlayer->mo == NULL ) return; players[consoleplayer].inventorytics = 0; if (hud_althudscale && SCREENWIDTH>640) { hudwidth=SCREENWIDTH/2; if (hud_althudscale == 2) { // Optionally just double the pixels to reduce scaling artifacts. hudheight=SCREENHEIGHT/2; } else { if (WidescreenRatio == 4) { hudheight = hudwidth * 30 / BaseRatioSizes[WidescreenRatio][3]; // BaseRatioSizes is inverted for this mode } else { hudheight = hudwidth * 30 / (48*48/BaseRatioSizes[WidescreenRatio][3]); } } } else { hudwidth=SCREENWIDTH; hudheight=SCREENHEIGHT; } if (!automapactive) { int i; // No HUD in the title level! if (gamestate == GS_TITLELEVEL || !CPlayer) return; if (!deathmatch) DrawStatus(CPlayer, 5, hudheight-50); else { DrawStatus(CPlayer, 5, hudheight-75); // [TP] Only draw frags if not playing in teams if (( GAMEMODE_GetCurrentFlags() & GMF_PLAYERSONTEAMS ) == 0 ) DrawFrags(CPlayer, 5, hudheight-70); } // [TP] Only draw health and armor if we are allowed to know those stats. Also don't // draw spectator's health/armor stats. if ( ShouldDrawHealth( CPlayer )) { DrawHealth(CPlayer, 5, hudheight-45); DrawArmor(CPlayer->mo->FindInventory<ABasicArmor>(), CPlayer->mo->FindInventory<AHexenArmor>(), 5, hudheight-20); } // [TP] Draw team stuff. DrawTeamScores( 10, hudheight - 90 ); i=DrawKeys(CPlayer, hudwidth-4, hudheight-10); i=DrawAmmo(CPlayer, hudwidth-5, i); DrawWeapons(CPlayer, hudwidth-5, i); DrawInventory(CPlayer, 144, hudheight-28); if (CPlayer->camera && CPlayer->camera->player) { StatusBar->DrawCrosshair(); } if (idmypos) DrawCoordinates(CPlayer); DrawTime(); } else { FString mapname; char printstr[256]; int seconds; int length=8*SmallFont->GetCharWidth('0'); int fonth=SmallFont->GetHeight()+1; int bottom=hudheight-1; if (am_showtotaltime) { seconds = level.totaltime / TICRATE; mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60); DrawHudText(SmallFont, hudcolor_ttim, printstr, hudwidth-length, bottom, FRACUNIT); bottom -= fonth; } if (am_showtime) { if (level.clusterflags&CLUSTER_HUB) { seconds = level.time /TICRATE; mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60); DrawHudText(SmallFont, hudcolor_time, printstr, hudwidth-length, bottom, FRACUNIT); bottom -= fonth; } // Single level time for hubs seconds= level.maptime /TICRATE; mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60); DrawHudText(SmallFont, hudcolor_ltim, printstr, hudwidth-length, bottom, FRACUNIT); } ST_FormatMapName(mapname); screen->DrawText(SmallFont, hudcolor_titl, 1, hudheight-fonth-1, mapname, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE); DrawCoordinates(CPlayer); } }
void CheckKeys (void) { int i; byte scan; unsigned temp; if (screenfaded || demoplayback) // don't do anything with a faded screen return; scan = LastScan; #ifdef SPEAR // // SECRET CHEAT CODE: TAB-G-F10 // if (Keyboard[sc_Tab] && Keyboard[sc_G] && Keyboard[sc_F10]) { WindowH = 160; if (godmode) { Message ("God mode OFF"); SD_PlaySound (NOBONUSSND); } else { Message ("God mode ON"); SD_PlaySound (ENDBONUS2SND); } IN_Ack(); godmode ^= 1; DrawAllPlayBorderSides (); IN_ClearKeysDown(); return; } #endif // // SECRET CHEAT CODE: 'MLI' // if (Keyboard[sc_M] && Keyboard[sc_L] && Keyboard[sc_I]) { gamestate.health = 100; gamestate.ammo = 99; gamestate.keys = 3; gamestate.score = 0; gamestate.TimeCount += 42000L; GiveWeapon (wp_chaingun); DrawWeapon(); DrawHealth(); DrawKeys(); DrawAmmo(); DrawScore(); ClearMemory (); CA_CacheGrChunk (STARTFONT+1); ClearSplitVWB (); VW_ScreenToScreen (displayofs,bufferofs,80,160); Message(STR_CHEATER1"\n" STR_CHEATER2"\n\n" STR_CHEATER3"\n" STR_CHEATER4"\n" STR_CHEATER5); UNCACHEGRCHUNK(STARTFONT+1); PM_CheckMainMem (); IN_ClearKeysDown(); IN_Ack(); DrawAllPlayBorder (); } // // OPEN UP DEBUG KEYS // #ifndef SPEAR if (Keyboard[sc_BackSpace] && Keyboard[sc_LShift] && Keyboard[sc_Alt] && MS_CheckParm("goobers")) #else if (Keyboard[sc_BackSpace] && Keyboard[sc_LShift] && Keyboard[sc_Alt] && MS_CheckParm("debugmode")) #endif { ClearMemory (); CA_CacheGrChunk (STARTFONT+1); ClearSplitVWB (); VW_ScreenToScreen (displayofs,bufferofs,80,160); Message("Debugging keys are\nnow available!"); UNCACHEGRCHUNK(STARTFONT+1); PM_CheckMainMem (); IN_ClearKeysDown(); IN_Ack(); DrawAllPlayBorderSides (); DebugOk=1; } // // TRYING THE KEEN CHEAT CODE! // if (Keyboard[sc_B] && Keyboard[sc_A] && Keyboard[sc_T]) { ClearMemory (); CA_CacheGrChunk (STARTFONT+1); ClearSplitVWB (); VW_ScreenToScreen (displayofs,bufferofs,80,160); Message("Commander Keen is also\n" "available from Apogee, but\n" "then, you already know\n" "that - right, Cheatmeister?!"); UNCACHEGRCHUNK(STARTFONT+1); PM_CheckMainMem (); IN_ClearKeysDown(); IN_Ack(); DrawAllPlayBorder (); } // // pause key weirdness can't be checked as a scan code // if (Paused) { bufferofs = displayofs; LatchDrawPic (20-4,80-2*8,PAUSEDPIC); SD_MusicOff(); IN_Ack(); IN_ClearKeysDown (); SD_MusicOn(); Paused = False; //if (MousePresent) // PORT // Mouse(MDelta); // Clear accumulated mouse movement return; } // // F1-F7/ESC to enter control panel // if ( #ifndef DEBCHECK scan == sc_F10 || #endif scan == sc_F9 || scan == sc_F7 || scan == sc_F8) // pop up quit dialog { ClearMemory (); ClearSplitVWB (); VW_ScreenToScreen (displayofs,bufferofs,80,160); US_ControlPanel(scan); DrawAllPlayBorderSides (); if (scan == sc_F9) StartMusic (); PM_CheckMainMem (); SETFONTCOLOR(0,15); IN_ClearKeysDown(); return; } if ( (scan >= sc_F1 && scan <= sc_F9) || scan == sc_Escape) { StopMusic (); ClearMemory (); VW_FadeOut (); US_ControlPanel(scan); SETFONTCOLOR(0,15); IN_ClearKeysDown(); DrawPlayScreen (); if (!startgame && !loadedgame) { VW_FadeIn (); StartMusic (); } if (loadedgame) playstate = ex_abort; lasttimecount = TimeCount; //if (MousePresent) // PORT // Mouse(MDelta); // Clear accumulated mouse movement PM_CheckMainMem (); return; } // // TAB-? debug keys // if (Keyboard[sc_Tab] && DebugOk) { CA_CacheGrChunk (STARTFONT); fontnumber=0; SETFONTCOLOR(0,15); DebugKeys(); //if (MousePresent) // PORT // Mouse(MDelta); // Clear accumulated mouse movement lasttimecount = TimeCount; return; } }
void CheckKeys (void) { boolean one_eighty=false; Uint8 scan; static boolean Plus_KeyReleased; static boolean Minus_KeyReleased; static boolean I_KeyReleased; static boolean S_KeyReleased; #if IN_DEVELOPMENT || BETA_TEST // if (DebugOk && (Keyboard[sc_p] || PP_step)) // PicturePause (); #endif if (screenfaded || demoplayback) // don't do anything with a faded screen return; scan = LastScan; #if IN_DEVELOPMENT #ifdef ACTIVATE_TERMINAL if (Keyboard[sc_9] && Keyboard[sc_0]) ActivateTerminal(true); #endif #endif // // SECRET CHEAT CODE: 'JAM' // #if GAME_VERSION != SHAREWARE_VERSION if (Keyboard[sc_j] || Keyboard[sc_a] || Keyboard[sc_m]) { if (jam_buff[sizeof(jam_buff_cmp)-1] != LastScan) { memcpy(jam_buff,jam_buff+1,sizeof(jam_buff_cmp)-1); jam_buff[sizeof(jam_buff_cmp)-1] = LastScan; } } #endif CheckMusicToggle(); if (gamestate.rpower) { if (in_is_binding_pressed(e_bi_radar_magnify)) { if (Plus_KeyReleased && gamestate.rzoom<2) { UpdateRadarGuage(); gamestate.rzoom++; Plus_KeyReleased=false; } } else Plus_KeyReleased=true; if (in_is_binding_pressed(e_bi_radar_minify)) { if (Minus_KeyReleased && gamestate.rzoom) { UpdateRadarGuage(); gamestate.rzoom--; Minus_KeyReleased=false; } } else Minus_KeyReleased=true; } if (in_is_binding_pressed(e_bi_sfx)) { if (S_KeyReleased) { if ((SoundMode != sdm_Off) || (DigiMode!=sds_Off)) { if (SoundMode != sdm_Off) { SD_WaitSoundDone(); SD_SetSoundMode(sdm_Off); } if (DigiMode!=sds_Off) SD_SetDigiDevice(sds_Off); memcpy((char *)&SoundOn[55],"OFF.",4); } else { ClearMemory(); if (SoundBlasterPresent || AdLibPresent) SD_SetSoundMode(sdm_AdLib); else SD_SetSoundMode(sdm_Off); if (SoundBlasterPresent) SD_SetDigiDevice(sds_SoundBlaster); else if (SoundSourcePresent) SD_SetDigiDevice(sds_SoundSource); else SD_SetDigiDevice(sds_Off); CA_LoadAllSounds(); memcpy((char *)&SoundOn[55],"ON. ",4); } DISPLAY_TIMED_MSG(SoundOn,MP_BONUS,MT_GENERAL); S_KeyReleased=false; } } else S_KeyReleased=true; if (Keyboard[sc_return]) { #if (GAME_VERSION != SHAREWARE_VERSION) || GEORGE_CHEAT char loop; if ((!memcmp(jam_buff,jam_buff_cmp,sizeof(jam_buff_cmp)))) { jam_buff[0]=0; for (loop=0; loop<NUMKEYS; loop++) if (gamestate.numkeys[static_cast<int>(loop)] < MAXKEYS) gamestate.numkeys[static_cast<int>(loop)]=1; gamestate.health = 100; gamestate.ammo = MAX_AMMO; gamestate.rpower = MAX_RADAR_ENERGY; if (!DebugOk) { gamestate.score = 0; gamestate.nextextra = EXTRAPOINTS; } gamestate.TimeCount += 42000L; for (loop=0; loop<NUMWEAPONS-1; loop++) GiveWeapon(loop); DrawWeapon(); DrawHealth(); DrawKeys(); DrawScore(); DISPLAY_TIMED_MSG("\r\r YOU CHEATER!",MP_INTERROGATE,MT_GENERAL); ForceUpdateStatusBar(); ClearMemory (); ClearSplitVWB (); VW_ScreenToScreen (static_cast<Uint16>(displayofs),static_cast<Uint16>(bufferofs),80,160); Message("\n NOW you're jammin'!! \n"); IN_ClearKeysDown(); IN_Ack(); CleanDrawPlayBorder(); } else if (!in_use_modern_bindings) #endif one_eighty=true; } // Handle quick turning! // if (!gamestate.turn_around) { // 90 degrees left // if (in_is_binding_pressed(e_bi_quick_left)) { gamestate.turn_around = -90; gamestate.turn_angle = player->angle + 90; if (gamestate.turn_angle > 359) gamestate.turn_angle -= ANGLES; } // 180 degrees right // if (in_is_binding_pressed(e_bi_turn_around) || one_eighty) { gamestate.turn_around = 180; gamestate.turn_angle = player->angle + 180; if (gamestate.turn_angle > 359) gamestate.turn_angle -= ANGLES; } // 90 degrees right // if (in_is_binding_pressed(e_bi_quick_right)) { gamestate.turn_around = 90; gamestate.turn_angle = player->angle - 90; if (gamestate.turn_angle < 0) gamestate.turn_angle += ANGLES; } } // // pause key weirdness can't be checked as a scan code // if (in_is_binding_pressed(e_bi_pause)) { SD_MusicOff(); fontnumber = 4; BMAmsg(PAUSED_MSG); IN_Ack(); IN_ClearKeysDown(); fontnumber = 2; RedrawStatusAreas(); SD_MusicOn(); Paused = false; ::in_clear_mouse_deltas(); return; } #if IN_DEVELOPMENT if (TestQuickSave) { // TestQuickSave--; scan = sc_f8; } if (TestAutoMapper) PopupAutoMap(); #endif scan = sc_none; if (Keyboard[sc_escape]) scan = sc_escape; else if (in_is_binding_pressed(e_bi_help)) scan = sc_f1; if (in_is_binding_pressed(e_bi_save)) scan = sc_f2; else if (in_is_binding_pressed(e_bi_load)) scan = sc_f3; else if (in_is_binding_pressed(e_bi_sound)) scan = sc_f4; else if (in_is_binding_pressed(e_bi_controls)) scan = sc_f6; else if (in_is_binding_pressed(e_bi_end_game)) scan = sc_f7; else if (in_is_binding_pressed(e_bi_quick_save)) scan = sc_f8; else if (in_is_binding_pressed(e_bi_quick_load)) scan = sc_f9; else if (in_is_binding_pressed(e_bi_quick_exit)) scan = sc_f10; switch (scan) { case sc_f7: // END GAME case sc_f10: // QUIT TO DOS FinishPaletteShifts(); ClearMemory(); US_ControlPanel(scan); CleanDrawPlayBorder(); return; case sc_f2: // SAVE MISSION case sc_f8: // QUICK SAVE // Make sure there's room to save... // ClearMemory(); FinishPaletteShifts(); if (!CheckDiskSpace(DISK_SPACE_NEEDED, CANT_SAVE_GAME_TXT, cds_id_print)) { CleanDrawPlayBorder(); break; } case sc_f1: // HELP case sc_f3: // LOAD MISSION case sc_f4: // SOUND MENU case sc_f5: // RESIZE VIEW case sc_f6: // CONTROLS MENU case sc_f9: // QUICK LOAD case sc_escape: // MAIN MENU refresh_screen = true; if (scan < sc_f8) VW_FadeOut(); StopMusic(); ClearMemory(); ClearSplitVWB(); US_ControlPanel(scan); if (refresh_screen) { boolean old = loadedgame; loadedgame = false; DrawPlayScreen(false); loadedgame = old; } ClearMemory(); if (!sqActive || !loadedgame) StartMusic(false); IN_ClearKeysDown(); if (loadedgame) { PreloadGraphics(); loadedgame = false; DrawPlayScreen(false); } else if (!refresh_screen) CleanDrawPlayBorder(); if (!sqActive) StartMusic(false); return; } scan = sc_none; if (in_is_binding_pressed(e_bi_stats)) PopupAutoMap(); if (Keyboard[sc_back_quote]) { Keyboard[sc_back_quote] = 0; TryDropPlasmaDetonator(); } if ((DebugOk || gamestate.flags & GS_MUSIC_TEST) && (Keyboard[sc_backspace])) { Uint8 old_num=music_num; if (gamestate.flags & GS_MUSIC_TEST) { if (Keyboard[sc_left_arrow]) { if (music_num) music_num--; Keyboard[sc_left_arrow]=false; } else if (Keyboard[sc_right_arrow]) { if (music_num < LASTMUSIC-1) music_num++; Keyboard[sc_right_arrow]=false; } if (old_num != music_num) { ClearMemory(); delete [] audiosegs[STARTMUSIC + old_num]; audiosegs[STARTMUSIC + old_num] = NULL; StartMusic(false); DrawScore(); } } if (old_num == music_num) { fontnumber=4; SETFONTCOLOR(0,15); if (DebugKeys()) { CleanDrawPlayBorder(); } ::in_clear_mouse_deltas(); lasttimecount = TimeCount; return; } } if (in_is_binding_pressed(e_bi_attack_info)) { if (I_KeyReleased) { gamestate.flags ^= GS_ATTACK_INFOAREA; if (gamestate.flags & GS_ATTACK_INFOAREA) DISPLAY_TIMED_MSG(attacker_info_enabled,MP_ATTACK_INFO,MT_GENERAL); else DISPLAY_TIMED_MSG(attacker_info_disabled,MP_ATTACK_INFO,MT_GENERAL); I_KeyReleased = false; } } else I_KeyReleased = true; #ifdef CEILING_FLOOR_COLORS if (in_is_binding_pressed(e_bi_ceiling)) { gamestate.flags ^= GS_DRAW_CEILING; in_reset_binding_state(e_bi_ceiling); } if (in_is_binding_pressed(e_bi_flooring)) { ThreeDRefresh(); ThreeDRefresh(); gamestate.flags ^= GS_DRAW_FLOOR; in_reset_binding_state(e_bi_flooring); #if DUAL_SWAP_FILES ChangeSwapFiles(true); #endif } #endif if (in_is_binding_pressed(e_bi_lightning)) { in_reset_binding_state(e_bi_lightning); gamestate.flags ^= GS_LIGHTING; } }