void ShowAllyInviteMenu_handler (edict_t *ent, int option) { edict_t *e = ent->client->allytarget; if (!e || !e->inuse) return; // make sure they can still ally if (!CanAlly(ent, e, ALLY_RANGE)) return; if (option == 1) { // notify inviter and his previous allies, if any gi.centerprintf(e, "Now allied with %s\n", ent->client->pers.netname); NotifyAllies(e, CENTERPRINT, va("Now allied with %s\n", ent->client->pers.netname)); // notify invitee's allies NotifyAllies(ent, CENTERPRINT, va("Now allied with %s\n", e->client->pers.netname)); // join allies AddAlly(ent, e); // notify invitee safe_cprintf(ent, PRINT_HIGH, "Ally added.\n"); // reset wait menu variables AbortAllyWait(ent); AbortAllyWait(e); // close the invitation menu closemenu(ent); if (InMenu(e, 0, ShowAllyWaitMenu_handler)) closemenu(e); } else if (option == 2) { // reset wait menu variables AbortAllyWait(ent); AbortAllyWait(e); // close the invitation menu closemenu(ent); if (InMenu(e, 0, ShowAllyWaitMenu_handler)) closemenu(e); safe_cprintf(e, PRINT_HIGH, "%s declined your offer to ally.\n", ent->client->pers.netname); } }
void ShowAllyWaitMenu_handler (edict_t *ent, int option) { edict_t *e = ent->client->allytarget; if (option == 666) //ent closed the menu { closemenu(ent); return; } if (e) { AbortAllyWait(e); if (InMenu(e, 0, ShowAllyInviteMenu_handler)) closemenu(e); } AbortAllyWait(ent); closemenu(ent); }
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; }