void deleterope(int ropenum) { int count; if (ropenum<0) return; if (ropenum>=numofropes) return; if (rope[ropenum].type==1) playsound(3,particle[rope[ropenum].part1].position,NULL,1.0f,0,1.0f,-1,0); if (rope[ropenum].type==2) playsound(3,particle[rope[ropenum].part1].position,NULL,1.0f,0,0.75f,-1,0); if (rope[ropenum].type==3) playsound(4,particle[rope[ropenum].part1].position,NULL,1.0f,0,1.0f,-1,0); if (rope[ropenum].type==4) playsound(4,particle[rope[ropenum].part1].position,NULL,1.0f,0,0.75f,-1,0); numofropes--; if (ropenum==numofropes) return; memcpy(&rope[ropenum],&rope[numofropes],sizeof(rope[0])); for (count=0;count<numofbonds;count++) if (bond[count].type==4 || bond[count].type==7) if (bond[count].objectnum==numofropes) bond[count].objectnum=ropenum; }
void togglesound(AUDIO_t *audio) { if (audio->enabled) { pausesound(audio); } else { playsound(audio); } }
void hit( void ) { sp_target(¤t_sprite, &enemy_sprite); playsound(30, 17050, 4000, ¤t_sprite, 0); //lock on to the guy who just hit us //playsound }
void die( void ) { if (get_sprite_with_this_brain(9, ¤t_sprite) == 0) { //no more brain 9 monsters here, lets unlock the screen screenlock(0); playsound(43, 22050,0,0,0); } int &hold = sp_editor_num(¤t_sprite); if (&hold != 0) editor_type(&hold, 6); &save_x = sp_x(¤t_sprite, -1); &save_y = sp_y(¤t_sprite, -1); external("emake","xlarge"); }
static int resurrect(void) { int j=NBBOT, jj, bestprix=0; struct bot bottmp; for (jj=NbHosts; jj<NBBOT; jj++) { if (bot[jj].camp==camp && plane_desc[bot[jj].navion].prix<=plane_desc[bot[controlled_bot].navion].prix && plane_desc[bot[jj].navion].prix>bestprix) { bestprix=plane_desc[bot[jj].navion].prix; j=jj; } } if (j<NBBOT) { memcpy(&bottmp,&bot[controlled_bot],sizeof(struct bot)); memcpy(&bot[controlled_bot],&bot[j],sizeof(struct bot)); memcpy(&bot[j],&bottmp,sizeof(struct bot)); bot[controlled_bot].gold=55; playsound(VOICE_EXTER, SAMPLE_ALLELUIA, 1., &voices_in_my_head, true, false); snd_thrust=-1; autopilot = true; accelerated_mode = false; map_x=obj[bot[controlled_bot].vion].pos.x/TILE_LEN; map_y=obj[bot[controlled_bot].vion].pos.y/TILE_LEN; return 1; } return 0; }
void hit(void) { say_xy("bhit.wav/22050Hz - barrel hit", 0, 380); playsound(37, 22050, 0,0,0); sp_seq(¤t_sprite, 173); wait(800); sp_pframe(¤t_sprite, 1); }
void common_playsound(UByte sound_to_play) { if (!dspStarted) { enableAudio(); } playsound(sound_to_play); }
void hit( void ) { sp_target(¤t_sprite, &enemy_sprite); //lock on to the guy who just hit us //playsound playsound(28, 22050,0,¤t_sprite, 0); }
void gunselect(int gun, fpsent *d) { if(gun!=d->gunselect) { addmsg(N_GUNSELECT, "rci", d, gun); playsound(S_WEAPLOAD, &d->o); } d->gunselect = gun; }
void setweapon(const char *name, bool force = false) { int gun = getweapon(name); //////////////////////////////////////////////////////////////////////////// if(player1->state!=CS_ALIVE || gun<GUN_FIST || gun>GUN_BOW) return; //////////////////////////////////////////////////////////////////////////// if(force || player1->ammo[gun]) gunselect(gun, player1); else playsound(S_NOAMMO); }
void COption::close () { playsound(SND_WIND); g_object_unref (G_OBJECT (categories_tree_model)); gtk_widget_destroy (window); showing = FALSE; g_pReciteWord->option_button.set_enable (TRUE); }
static gboolean on_textbutton_buttonpress (GtkWidget * widget, GdkEventButton * event, tTextButton * parent) { if (!parent->enable) return TRUE; playsound (SND_BUTTONDOWN); parent->draw(true); return TRUE; }
void die( void ) { if (get_sprite_with_this_brain(9, ¤t_sprite) == 0) { //no more brain 9 monsters here, lets unlock the screen screenlock(0); playsound(43, 22050,0,0,0); } &save_x = sp_x(¤t_sprite, -1); &save_y = sp_y(¤t_sprite, -1); external("emake","large"); void attack( void ) { playsound(8, 5050,0,¤t_sprite, 0); &mcounter = random(4000,0); sp_attack_wait(¤t_sprite, &mcounter); }
void main(void ) { int &mycrap = create_sprite(&save_x, &save_y, 0, 161, 1); sp_script(&mycrap, "dam-bomn"); sp_range(&mycrap, 30); sp_brain(&mycrap, 17); playsound(6, 22050, 0,0,0); sp_seq(&mycrap, 161); //sp_touch_damage(&mycrap, 10); sp_strength(&mycrap, 25); }
void COption::show () { init (); playsound(SND_WIND); showing = TRUE; GtkWidget *hbox; GtkWidget *r; GtkWidget *l; GtkWidget *ct; GtkWidget *label; window = gtk_dialog_new(); g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (on_window_delete_event), this); gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (g_pReciteWord->window)); gtk_dialog_add_button (GTK_DIALOG (window), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); gtk_dialog_set_default_response (GTK_DIALOG (window), GTK_RESPONSE_CLOSE); g_signal_connect(G_OBJECT (window), "response", G_CALLBACK (rw_preferences_dialog_response_handler), this); hbox = gtk_hbox_new (FALSE, 18); gtk_container_set_border_width (GTK_CONTAINER (hbox), 10); r = gtk_vbox_new (FALSE, 6); label = gtk_label_new_with_mnemonic (_("Cat_egories:")); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); g_object_set (G_OBJECT (label), "xalign", 0.0, NULL); ct = rw_preferences_dialog_create_categories_tree (this); gtk_box_pack_start (GTK_BOX (r), label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (r), ct, TRUE, TRUE, 0); l = rw_preferences_dialog_create_notebook (this); gtk_box_pack_start (GTK_BOX (hbox), r, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), l, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), hbox, FALSE, FALSE, 0); gtk_label_set_mnemonic_widget (GTK_LABEL (label), categories_tree); gtk_widget_show_all (GTK_DIALOG (window)->vbox); gtk_window_set_title (GTK_WINDOW (window), _("Preferences")); gtk_window_set_resizable (GTK_WINDOW (window), FALSE); gtk_widget_show(window); }
void damage( void ) { int &hold = sp_editor_num(&missile_target); if (&missile_target == 0) { sp_speed(¤t_sprite, 0); sp_brain(¤t_sprite, 0); sp_nohit(¤t_sprite, 1); playsound(41, 22050,0,0,0); // sp_script(¤t_sprite, ""); kill_this_task(); } if (&hold != 0) { &scrap = sp_brain(&missile_target, -1); if (&scrap != 0) { //looks like we should not make the arrow stick kill_shadow(¤t_sprite); sp_active(¤t_sprite, 0); playsound(41, 22050,0,0,0); return; } sp_speed(¤t_sprite, 0); sp_brain(¤t_sprite, 0); playsound(41, 22050,0,0,0); // sp_script(¤t_sprite, ""); return; } kill_shadow(¤t_sprite); sp_active(¤t_sprite, 0); playsound(41, 22050,0,0,0); // sp_script(¤t_sprite, ""); kill_this_task(); }
static DWORD CALLBACK SendFileToCalcThread(LPVOID lpParam) { LPCALC lpCalc = (LPCALC) lpParam; LPSENDINFO lpsi = g_SendInfo[lpCalc]; BOOL fRunningBackup = lpCalc->running; BOOL fSoundBackup = FALSE; if (lpCalc->audio) fSoundBackup = lpCalc->audio->enabled; lpCalc->running = FALSE; if (fSoundBackup) { pausesound(lpCalc->audio); } lpsi->Error = LERR_SUCCESS; for (lpsi->iCurrentFile = 0; (UINT)lpsi->iCurrentFile < lpsi->FileList->size(); lpsi->iCurrentFile++) { const TCHAR *filename = lpsi->FileList->at(lpsi->iCurrentFile).c_str(); TIFILE_t *var = importvar(filename, TRUE); if (var != NULL && var->type != ROM_TYPE && var->type != SAV_TYPE) { PostMessage(lpsi->hwndDlg, WM_USER, 0, NULL); } else { lpsi->isRom = true; } lpsi->Error = SendFile(lpCalc, filename, lpsi->DestinationList->at(lpsi->iCurrentFile)); if (lpsi->Error != LERR_SUCCESS) { if (MessageBox(lpsi->hwndDlg, g_szLinkErrorDescriptions[lpsi->Error], _T("Wabbitemu"), MB_OKCANCEL | MB_ICONERROR) == IDCANCEL) { break; } } } if (WaitForSingleObject(lpsi->hFileListMutex, INFINITE) == WAIT_OBJECT_0) { lpsi->FileList->clear(); ReleaseMutex(lpsi->hFileListMutex); } if (lpsi->hwndDlg != NULL) { HWND hwndDlg = lpsi->hwndDlg; lpsi->hwndDlg = NULL; PostMessage(hwndDlg, WM_CLOSE, 0, NULL); } lpCalc->running = fRunningBackup; if (fSoundBackup == TRUE) { playsound(lpCalc->audio); } current_file_sending = NULL; lpsi->DestinationList->clear(); lpsi->iCurrentFile = 0; return 0; }
void nextweapon(int dir, bool force = false) { if(player1->state!=CS_ALIVE) return; dir = (dir < 0 ? NUMGUNS-1 : 1); int gun = player1->gunselect; loopi(NUMGUNS) { gun = (gun + dir)%NUMGUNS; if(force || player1->ammo[gun]) break; } if(gun != player1->gunselect) gunselect(gun, player1); else playsound(S_NOAMMO); }
static gint on_textbutton_buttonrelease (GtkWidget * widget, GdkEventButton * event, tTextButton * parent) { if (!parent->enable) return TRUE; playsound (SND_BUTTONUP); parent->draw(false); if (parent->mousein) { (*(parent->runfunc)) (parent->funcdata); } return TRUE; }
void cycleweapon(int numguns, int *guns, bool force = false) { if(numguns<=0 || player1->state!=CS_ALIVE) return; int offset = 0; loopi(numguns) if(guns[i] == player1->gunselect) { offset = i+1; break; } loopi(numguns) { int gun = guns[(i+offset)%numguns]; if(gun>=0 && gun<NUMGUNS && (force || player1->ammo[gun])) { gunselect(gun, player1); return; } } playsound(S_NOAMMO); }
int password (Mix_Chunk* gSound, short* musique, Mix_Music* gMusic, short* onoff) { SDL_Window* fenetrepass = NULL; char texte[PASSMAX] = {0}; size_t passlen = 0, l; SDL_bool done = SDL_FALSE; SDL_Rect rect; SDL_Event ev; SDL_Surface* ValiderTTF = NULL; SDL_Rect ValiderRect; SDL_Color ValiderColor = {0, 0, 0, 0}; int ValiderTTFW = 0; int ValiderTTFH = 0; SDL_Surface* AnnulerTTF = NULL; SDL_Rect AnnulerRect; SDL_Color AnnulerColor = {0, 0, 0, 0}; int AnnulerTTFW = 0; int AnnulerTTFH = 0; TTF_Font* contfuFont = NULL; TTF_Font* helvFont = NULL; SDL_Surface* surface = NULL; helvFont = chargerPolice (helvFont, HELVFONT, 35); contfuFont = chargerPolice (contfuFont, CONTFUFONT, 50); SDL_Surface* surfaceTexte = NULL; SDL_Color color2 = {255, 255, 255, 0}; SDL_Color color = {0, 0, 0, 0}; fenetrepass = creerFenetre (fenetrepass, TITREJEU, LARGEUR_FENETREPASS, HAUTEUR_FENETREPASS); SDL_StartTextInput(); while (!done) { SDL_WaitEvent (&ev); switch (ev.type) { case SDL_QUIT : // Ne marche pas, je sais pas pourquoi printf ("Good bye\n"); done = SDL_TRUE; break; case SDL_KEYDOWN : if (ev.key.keysym.sym == SDLK_BACKSPACE && passlen > 0) { texte[passlen - 1] = 0; passlen--; puts (texte); } else if (ev.key.keysym.sym == SDLK_ESCAPE) { done = SDL_TRUE; } else if (ev.key.keysym.sym == SDLK_RETURN) { printf ("testvalider\n"); valider (texte, gSound, musique, gMusic, onoff, &done); } break; case SDL_TEXTINPUT : l = strlen (ev.text.text); strncpy (texte + passlen, ev.text.text, PASSMAX - 1 - passlen); passlen += l; if (passlen > PASSMAX - 1) { passlen = PASSMAX - 1; } puts (texte); break; case SDL_MOUSEBUTTONDOWN: playsound (3, gSound); if (clickMenu (helvFont, "Valider", ValiderTTFW, ValiderTTFH, ev, ValiderRect) ) { printf ("testvalider\n"); valider (texte, gSound, musique, gMusic, onoff, &done); ev.type = SDL_KEYDOWN; ev.key.keysym.sym = SDLK_1; SDL_PushEvent (&ev); } if (clickMenu (helvFont, "Annuler", AnnulerTTFW, AnnulerTTFH, ev, AnnulerRect) ) { done = SDL_TRUE; } break; case SDL_MOUSEMOTION: ValiderColor.r = hoverMenu (helvFont, "Valider", ValiderTTFW, ValiderTTFH, ev, ValiderRect); AnnulerColor.r = hoverMenu (helvFont, "Annuler", AnnulerTTFW, AnnulerTTFH, ev, AnnulerRect); break; } surface = SDL_GetWindowSurface (fenetrepass); SDL_FillRect (surface, NULL, SDL_MapRGB (surface->format, 204, 72, 63) ); surfaceTexte = creerTexte (surfaceTexte, METHODE_BELLE, contfuFont, "Mot de passe", color2); rect.x = (LARGEUR_FENETREPASS / 2) - (surfaceTexte->w / 2); rect.y = HAUTEUR_FENETREPASS / 8; SDL_BlitSurface (surfaceTexte, NULL, surface, &rect); SDL_FreeSurface (surfaceTexte); ValiderTTF = creerTexte (ValiderTTF, METHODE_RAPIDE, helvFont, "Valider", ValiderColor); ValiderRect.x = (LARGEUR_FENETREPASS / 4) - (ValiderTTF->w / 2); ValiderRect.y = (3 * HAUTEUR_FENETREPASS) / 4; SDL_BlitSurface (ValiderTTF, NULL, surface, &ValiderRect); SDL_FreeSurface (ValiderTTF); AnnulerTTF = creerTexte (AnnulerTTF, METHODE_RAPIDE, helvFont, "Annuler", AnnulerColor); AnnulerRect.x = (3 * LARGEUR_FENETREPASS / 4) - (AnnulerTTF->w / 2); AnnulerRect.y = (3 * HAUTEUR_FENETREPASS) / 4; SDL_BlitSurface (AnnulerTTF, NULL, surface, &AnnulerRect); SDL_FreeSurface (AnnulerTTF); SDL_UpdateWindowSurface (fenetrepass); if (passlen > 0) { surfaceTexte = creerTexte (surfaceTexte, METHODE_BELLE, helvFont, texte, color); rect.x = (LARGEUR_FENETREPASS / 2) - (surfaceTexte->w / 2); rect.y = HAUTEUR_FENETREPASS / 2; SDL_BlitSurface (surfaceTexte, NULL, surface, &rect); SDL_FreeSurface (surfaceTexte); SDL_UpdateWindowSurface (fenetrepass); } } SDL_StopTextInput(); libererPolice (helvFont); libererPolice (contfuFont); SDL_DestroyWindow (fenetrepass); return 0; }
void valider (char* texte, Mix_Chunk* gSound, short* musique, Mix_Music* gMusic, short* onoff, SDL_bool* done) { if (strcmp (texte, "yolo") == 0) { printf ("c est bien\n"); playsound (1, gSound); } else if (strcmp (texte, "rick") == 0) { printf ("c est bien\n"); playsound (1, gSound); SDL_Delay (1000); *musique = 5; *onoff = 0; playmusic (*musique, gMusic); *done = SDL_TRUE; } else if (strcmp (texte, "love") == 0) { printf ("c est bien\n"); playsound (1, gSound); SDL_Delay (1000); *musique = 7; *onoff = 0; playmusic (*musique, gMusic); *done = SDL_TRUE; } else if (strcmp (texte, "hardcore") == 0) { printf ("c est bien\n"); playsound (1, gSound); SDL_Delay (1000); fenetreJeu ("Hardcore/", 3, 255, 255, 255, gSound, gMusic, musique, onoff, 14316556, 0); *done = SDL_TRUE; } else if (strcmp (texte, "nyan cat") == 0) { printf ("c est bien\n"); playsound (1, gSound); SDL_Delay (1000); *onoff = 0; playmusic (8, gMusic); fenetreJeu ("Cat/", 0, 255, 255, 255, gSound, gMusic, musique, onoff, 1450, 2); *done = SDL_TRUE; } else if (strcmp (texte, "kubiak") == 0) { printf ("c est bien\n"); playsound (1, gSound); SDL_Delay (1000); *onoff = 0; playmusic (7, gMusic); fenetreJeu ( "secret/", 0, 255, 105, 180, gSound, gMusic, musique, onoff, 2000, 1); *done = SDL_TRUE; } else if (strcmp (texte, "heyayayay") == 0) { printf ("c est bien\n"); playsound (1, gSound); SDL_Delay (1000); *onoff = 0; playmusic (9, gMusic); fenetreJeu ( "Hey/", 0, 255, 105, 180, gSound, gMusic, musique, onoff, 1450, 2); *done = SDL_TRUE; } else { printf ("c est rate\n"); playsound (2, gSound); } return; }
void use( void ) { activate_bow(); &mypower = get_last_bow_power(); &mholdx = sp_x(1, -1); &mholdy = sp_y(1, -1); &mydir = sp_dir(1, -1); if (&mypower < 100) { return; } playsound(44, 22050,0,0,0); if (&mydir == 6) { &mholdx += 30; &junk = create_sprite(&mholdx, &mholdy, 11, 25, 6); sp_dir(&junk, 6); } if (&mydir == 4) { &mholdx -= 30; &junk = create_sprite(&mholdx, &mholdy, 11, 25, 4); sp_dir(&junk, 4); } if (&mydir == 2) { &junk = create_sprite(&mholdx, &mholdy, 11, 25, 2); sp_dir(&junk, 2); } if (&mydir == 8) { &junk = create_sprite(&mholdx, &mholdy, 11, 25, 8); sp_dir(&junk, 8); } if (&mydir == 9) { &junk = create_sprite(&mholdx, &mholdy, 11, 25, 5); sp_dir(&junk, 9); } if (&mydir == 1) { &junk = create_sprite(&mholdx, &mholdy, 11, 25, 1); sp_dir(&junk, 1); } if (&mydir == 7) { &junk = create_sprite(&mholdx, &mholdy, 11, 25, 7); sp_dir(&junk, 7); } if (&mydir == 3) { &junk = create_sprite(&mholdx, &mholdy, 11, 25, 3); sp_dir(&junk, 3); } &mypower / 100; &temp = &strength; &temp / 5; if (&temp == 0) { &temp = 1; } &mypower * &temp; sp_timing(&junk, 0); if (&bowlore == 1) { &temp = random(2, 1); if (&temp == 1) { //critical hit &mypower * 3; playsound(44, 14050,0,0,0); say("`4* POWER SHOT *", 1); } } sp_speed(&junk, 6); sp_strength(&junk, &mypower); sp_range(&junk, 10); //this makes it easier to hit stuff sp_flying(&junk, 1); sp_script(&junk, "dam-a1"); //when the fireball hits something, it will look to this script, this way //we can burn trees when appropriate &mshadow = create_sprite(&mholdx, &mholdy, 15, 432, 3); sp_brain_parm(&mshadow, &junk); sp_que(&mshadow, -500); sp_brain_parm(&junk, 1); sp_brain_parm2(&junk, &mshadow); sp_nohit(&mshadow, 1); return; }
/* DigiBand (c)2005 Seijinohki PC Services and Software, This code written by Joe Wall with assitance from Velex * Loutzenhiser, and respected other parties. This code is protected under the GPL License. For any questions * regarding this code, please contact Joe @ www.seijinohki.net. * * This software is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the: * Free Software Foundation, Inc. * 59 Temple Place - Suite 330 * Boston, MA 02111-1307, USA */ void gameselectscreen(int totalframes){ #ifdef EXCESSIVE printf("gameselectscreen\n"); #endif if (currscreen!=prevscreen){ if (presong>-1&&presong<gbsongcount){ if(songsloaded>0)unloadwaves(); } if (thesong>-1&&thesong<gbsongcount){ if(songsloaded>0)loadwaves(); } playsound(14,"selectmode.wav"); } static bool hasavi=true; currstage=1; gptscore=0; gpg1tscore=0; gpg2tscore=0; gplifebar=50; gpg1lifebar=50; gpg2lifebar=50; static drawtext drumplayer; drumplayer.load("Drum Player","silly.ttf",255,255,255,uivars.mode_drumtext1_s); static drawtext drumplayer2; drumplayer2.load("Press Start","silly.ttf",255,255,255,uivars.mode_drumtext2_s); static drawtext guit1player; guit1player.load("Guitar Player 1","silly.ttf",255,255,255,uivars.mode_guitar1text1_s); static drawtext guit2player; guit2player.load("Guitar Player 2","silly.ttf",255,255,255,uivars.mode_guitar2text1_s); draw_quad(0,512,384,-9000,640,400,255,255,255,255,0,0,11); static double aniframes1=90; static double aniframes2=90; static double aniframes3=90; static int lastframe=0; draw_quad(0,uivars.mode_drumgraphic_x,uivars.mode_drumgraphic_y,-300,161,251,255,255,255,255,0,0,5); draw_quad(0,uivars.mode_guitar1graphic_x,uivars.mode_guitar1graphic_y,-300,161,251,255,255,255,255,0,0,5); draw_quad(0,uivars.mode_guitar2graphic_x,uivars.mode_guitar2graphic_y,-300,161,251,255,255,255,255,0,0,5); if (drummode==true){ aniframes1-=10*double(steptime)/16.0; if (aniframes1<0){ aniframes1=0;} }else{ aniframes1=90; } if (guitar1mode==true){ aniframes2-=10*double(steptime)/16.0; if (aniframes2<0){ aniframes2=0;} }else{ aniframes2=90; } if (guitar2mode==true){ aniframes3-=10*double(steptime)/16.0; if (aniframes3<0){ aniframes3=0;} }else{ aniframes3=90; } draw_quad(0,uivars.mode_drumgraphic_x,uivars.mode_drumgraphic_y,-100,163,253,255,255,255,255,int(aniframes1),0,8); draw_quad(0,uivars.mode_guitar1graphic_x,uivars.mode_guitar1graphic_y,-100,163,253,255,255,255,255,int(aniframes2),0,9); draw_quad(0,uivars.mode_guitar2graphic_x,uivars.mode_guitar2graphic_y,-100,163,253,255,255,255,255,int(aniframes3),0,10); if (!drummode){ drumplayer.draw(uivars.mode_drumtext1_x,uivars.mode_drumtext1_y,0,255,128,128,255,true,true); drumplayer2.draw(uivars.mode_drumtext2_x,uivars.mode_drumtext2_y,10,255,128,128,255,true,true); } if (!guitar1mode){ guit1player.draw(uivars.mode_guitar1text1_x,uivars.mode_guitar1text1_y,0,255,128,128,255,true,true); drumplayer2.draw(uivars.mode_guitar1text2_x,uivars.mode_guitar1text2_y,10,255,128,128,255,true,true); } if (!guitar2mode){ guit2player.draw(uivars.mode_guitar2text1_x,uivars.mode_guitar2text1_y,0,255,128,128,255,true,true); drumplayer2.draw(uivars.mode_guitar2text2_x,uivars.mode_guitar2text2_y,10,255,128,128,255,true,true); } if (optionselected<0) optionselected=1; if (optionselected>1) optionselected=0; static drawtext gamemodetext; static drawtext waitforplayer; if (!arcademode){ if (optionselected==0){ gamemodetext.load(" Press Start! ","font.ttf",255,255,255,uivars.mode_start_s); } if (optionselected==1){ gamemodetext.load(" Press Start! ","font.ttf",255,255,255,uivars.mode_start_s); } } waitforplayer.load("Waiting for other players. To skip, press start.","font.ttf",255,255,255,uivars.mode_message_s); if (!screenfaddingout&&!screenfaddingin&&currscreen==4)draw_quad(0,512,384,5000,640,400,255,255,255,255,0,0,12);//must be at end. if (screenfaddingin&&lastscreen==1&&nextscreen!=5)draw_quad(0,512,384,5000,640,400,255,255,255,255,0,0,12);//must be at end. if (screenfaddingout&&lastscreen==1&&nextscreen!=5)draw_quad(0,512,384,5000,640,400,255,255,255,255,0,0,12);//must be at end. if (screenfaddingout&&currscreen==4&&nextscreen==1)draw_quad(0,512,384,5000,640,400,255,255,255,255,0,0,12);//must be at end. if (drummode||guitar1mode||guitar2mode){ waitforplayer.draw(uivars.mode_message_x,uivars.mode_message_y,5100,255,128,128,255,true,true); } if (!screenfaddingin&&!screenfaddingout){ if (!arcademode) gamemodetext.draw(uivars.mode_start_x,uivars.mode_start_y,5100,255,128,128,255,true,true); static char screentext[128]; sprintf(screentext,"Select Game Mode"); static drawtext screentextt; screentextt.load(screentext,"font.ttf",255,255,255,uivars.mode_screenname_s); screentextt.draw(uivars.mode_screenname_x,uivars.mode_screenname_y,5100,255,255,255,255,false,true); } if (arcademode){ static char option1[256]; sprintf(option1,"Coins %i/%i Credits (%i)",coinsinserted,coinsperplay,credits); static drawtext option1s; option1s.load(option1,"font.ttf",255,255,255,20); option1s.draw(415,20,5100,255,255,255,255,false,true); } //counter if (arcademode){ if (menucountertime>0){ static long timer=0; if (currscreen!=prevscreen) timer=SDL_GetTicks(); int timeleft=int(double(menucountertime)-((double(SDL_GetTicks())-double(timer))/1000.0)); char disptime[10]; sprintf(disptime,"%i",timeleft); static drawtext timerdisp; timerdisp.load(disptime,"font.ttf",255,255,255,uivars.timer_s); draw_quad(0,27,743,9800,25,25,255,255,255,255,0,0,66); if (timeleft>5){ timerdisp.draw(uivars.timer_x-(timerdisp.width/2),uivars.timer_y-(timerdisp.height/2),9900,255,255,255,255,false,true); }else{ if (timeleft==5)playsound(17,"timer.wav"); timerdisp.draw(uivars.timer_x-(timerdisp.width/2),uivars.timer_y-(timerdisp.height/2),9900,255,128,128,255,true,true); } if (timeleft==0){ screenfaddingout=true; nextscreen=5; screenchangenow=false; } } } }
void GuiControl::menuKeyClickTrigger() { playsound(S_MENUCLICK); }
void attack( void ) { playsound(31, 22050,0,¤t_sprite, 0); &mcounter = random(4000,0); sp_attack_wait(¤t_sprite, &mcounter); }
void objectanimation(void) { int count,count2; int particlelist[2]; float vec[3]; float intersectpoint[3]; float normal[3]; float scale; for (count=0;count<numofobjects;count++) { if (object[count].type==1) { /* for (count2=0;count2<object[count].numofparticles;count2++) if ((rand()&8191)==0) createparticle(5,particle[object[count].particle[count2]].position,particle[object[count].particle[count2]].velocity,0.125f,-1,100); */ if (object[count].frame==12) { object[count].framedelay+=0.125f; if (object[count].framedelay>=1.0f) { object[count].frame=0; object[count].framedelay=0.0f; } } if (object[count].numoforientations==0) { if (object[count].frame>=5 && object[count].frame<=7) object[count].frame=1; if (object[count].frame<4) { object[count].framedelay+=1.0f; if (object[count].framedelay>=4.0f) { object[count].frame++; object[count].framedelay=0.0f; } } } else { if (object[count].frame>0 && object[count].frame<=4) { object[count].framedelay+=1.0f; if (object[count].framedelay>=4.0f) { object[count].frame--; object[count].framedelay=0.0f; } } if (object[count].frame==0) if ((rnd()&255)==0) object[count].frame=5; if (object[count].frame>=5 && object[count].frame<=7) { object[count].framedelay+=1.0f; if (object[count].framedelay>=4.0f) { object[count].frame++; if (object[count].frame==8) object[count].frame=0; object[count].framedelay=0.0f; } } } if ((object[count].button&8)==8) if (object[count].frame<8) { object[count].frame=8; object[count].framedelay=0.0f; } if (object[count].frame>=8 && object[count].frame<=11) { object[count].framedelay+=1.0f; if (object[count].framedelay>=4.0f) { if ((object[count].button&8)==8) { if (object[count].frame<11) object[count].frame++; } else { if (object[count].frame>7) object[count].frame--; if (object[count].frame==7) object[count].frame=0; } object[count].framedelay=0.0f; } } } if (object[count].type==4) { if (object[count].animationtype==0 || object[count].animationtype==1) if ((object[count].button&1)==1) { object[count].animationtype=2; object[count].frame=0; object[count].framedelay=0.0f; } if (object[count].beasttype==12) if (object[count].animationtype==0) if ((object[count].button&2)==2) { object[count].animationtype=1; object[count].frame=0; object[count].framedelay=0.0f; } if (object[count].animationtype==0) { if (object[count].link!=-1) { object[object[count].link].texturenum=animation[object[count].animationnum+32].stand[0]; if (fabs(object[0].position[0]-object[count].position[0])<1.5f) if (object[0].position[1]>object[count].position[1]) object[object[count].link].texturenum=animation[object[count].animationnum+32].stand[1]; } object[count].framedelay+=0.1f; if (object[count].framedelay>=1.0f) { object[count].framedelay=0.0f; object[count].frame++; if (object[count].frame>=animation[object[count].animationnum].stand[1]) object[count].frame=0; } object[count].texturenum=animation[object[count].animationnum].stand[0]+object[count].frame; if (vectorlength(object[count].velocity)>=0.01f) { object[count].animationtype=1; object[count].frame=0; object[count].framedelay=0.0f; } } if (object[count].animationtype==1) { if (object[count].link!=-1) { object[object[count].link].texturenum=animation[object[count].animationnum+32].walk[0]; if (fabs(object[0].position[0]-object[count].position[0])<1.5f) if (object[0].position[1]>object[count].position[1]) object[object[count].link].texturenum=animation[object[count].animationnum+32].stand[1]; } if (object[count].beasttype!=12) object[count].framedelay+=vectorlength(object[count].velocity)*6.0f; else object[count].framedelay+=0.2f; if (object[count].framedelay>=1.0f) { object[count].framedelay=0.0f; object[count].frame++; if (object[count].frame>=animation[object[count].animationnum].walk[1]) { object[count].frame=0; if (object[count].beasttype==12) object[count].animationtype=0; } } object[count].texturenum=animation[object[count].animationnum].walk[0]+object[count].frame; if (object[count].beasttype!=12) if (vectorlength(object[count].velocity)<0.01f) { object[count].animationtype=0; object[count].frame=0; object[count].framedelay=0.0f; } if (object[count].beasttype==12) if (object[count].frame==4) if (object[count].framedelay==0.0f) { addvectors(vec,object[count].position,yaxis); createbeast(11,vec,1.0f,1.0f,1.0f,0.2f); object[numofobjects-1].timetolive=512; object[numofobjects-1].link=-1; for (count2=0;count2<4;count2++) { particle[object[numofobjects-1].particle[count2]].velocity[1]=0.08f; if (object[count].direction==0) particle[object[numofobjects-1].particle[count2]].velocity[0]=-0.04f; else particle[object[numofobjects-1].particle[count2]].velocity[0]=0.04f; } } } if (object[count].animationtype==2) { if (object[count].link!=-1) object[object[count].link].texturenum=animation[object[count].animationnum+32].attack[0]; object[count].framedelay+=0.2f; if (object[count].framedelay>=1.0f) { object[count].framedelay=0.0f; object[count].frame++; if (object[count].frame>=animation[object[count].animationnum].attack[1]) { object[count].animationtype=0; object[count].frame=0; } } object[count].texturenum=animation[object[count].animationnum].attack[0]+object[count].frame; if (object[count].frame==1) if (object[count].framedelay==0.0f) { if (object[count].beasttype<3 || object[count].beasttype==8 || object[count].beasttype==11 || object[count].beasttype==16) playsound(11,object[count].position,NULL,0.25f,0,0.7f,-1,0); else if (object[count].beasttype==7 || object[count].beasttype==13) playsound(12,object[count].position,NULL,0.5f,0,1.0f,-1,0); else playsound(13,object[count].position,NULL,0.5f,0,1.0f,-1,0); } if (object[count].frame==5) { //if (object[count].beasttype!=7 && object[count].beasttype!=13) { scale=1.25f; if (object[count].beasttype<3 || object[count].beasttype==8 || object[count].beasttype==11 || object[count].beasttype==16) scale=0.75f; if (object[count].beasttype==15) scale=1.5f; if (object[count].beasttype==7 || object[count].beasttype==13) scale=3.0f; if (object[count].direction==0) scaleaddvectors(vec,object[count].position,object[count].orientation[0],-scale); if (object[count].direction==1) scaleaddvectors(vec,object[count].position,object[count].orientation[0],scale); if (lineintersectobject(intersectpoint,normal,&scale,object[count].position,vec,0,particlelist)) { scale=0.06f; if (object[count].beasttype<3) scale=0.03f; if (object[count].beasttype==15) scale=0.15f; if (object[count].direction==0) { scaleaddvectors(particle[particlelist[0]].velocity,particle[particlelist[0]].velocity,object[count].orientation[0],-scale); scaleaddvectors(particle[particlelist[1]].velocity,particle[particlelist[1]].velocity,object[count].orientation[0],-scale); } if (object[count].direction==1) { scaleaddvectors(particle[particlelist[0]].velocity,particle[particlelist[0]].velocity,object[count].orientation[0],scale); scaleaddvectors(particle[particlelist[1]].velocity,particle[particlelist[1]].velocity,object[count].orientation[0],scale); } if (object[count].beasttype<3 || object[count].beasttype==11) object[0].hitpoints-=20; else object[0].hitpoints-=40; if (object[count].beasttype==15) object[0].hitpoints-=40; } } if (object[count].beasttype==7 || object[count].beasttype==13) if (object[count].framedelay==0.0f) { if (object[count].beasttype==7) createbeast(2,object[count].position,1.0f,1.0f,1.0f,0.2f); else createbeast(8,object[count].position,1.0f,1.0f,1.0f,0.2f); object[numofobjects-1].timetolive=512; object[numofobjects-1].link=-1; for (count2=0;count2<4;count2++) { if (object[count].direction==0) particle[object[numofobjects-1].particle[count2]].velocity[0]=-0.08f; else particle[object[numofobjects-1].particle[count2]].velocity[0]=0.08f; } } } } if (object[count].timetolive>=0 && object[count].timetolive<45) { if (object[count].timetolive==44) { if (object[count].beasttype<3 || object[count].beasttype==8 || object[count].beasttype==11 || object[count].beasttype==16) { game.score[0]+=100*game.combo; createsprite(100*game.combo,object[count].position); game.combo++; game.combodelay+=100; if (game.combodelay>250) game.combodelay=250; playsound(7,object[count].position,NULL,1.0f,0,1.0f,-1,0); } else { game.score[0]+=200*game.combo; createsprite(200*game.combo,object[count].position); game.combo++; game.combodelay+=100; if (game.combodelay>250) game.combodelay=250; playsound(19,object[count].position,NULL,1.0f,0,1.0f,-1,0); } for (count2=0;count2<10;count2++) { vec[0]=(float)((rnd()&255)-127)/1270.0f; vec[1]=(float)((rnd()&255)-127)/1270.0f; vec[2]=0.0f; addvectors(vec,vec,object[count].velocity); createparticle(5,object[count].position,vec,0.25f,-1,100+(rnd()&63)); particle[numofparticles-1].rendersize=0.125+(float)(rnd()&127)/1000.0f; particle[numofparticles-1].texturenum=367; if (object[count].beasttype==11 || object[count].beasttype==12) particle[numofparticles-1].texturenum=364; if (object[count].beasttype==0 || object[count].beasttype==3 || object[count].beasttype==4) particle[numofparticles-1].texturenum=365; } } if (object[count].link!=-1) { object[object[count].link].texturenum=animation[object[count].animationnum+32].die[0]; if (object[object[count].link].timetolive>150) object[object[count].link].timetolive=150; } object[count].animationtype=3; object[count].frame=8-object[count].timetolive/5; object[count].framedelay=0.0f; object[count].texturenum=animation[object[count].animationnum].die[0]+object[count].frame; } } } if (game.levelnum==34) if (object[1].type==2) if ((rnd()&255)==0) { object[1].texturenum=64+(rnd()&3); } }
void togglesound(AUDIO_t *audio) { if (audio->enabled) pausesound(audio); else playsound(audio); }
// Reset peripherals and cpu void HAL::resetHardware() { //Davinci Specific, fancy effect playsound (1000,400); RSTC->RSTC_CR = RSTC_CR_KEY(0xA5) | RSTC_CR_PERRST | RSTC_CR_PROCRST; }
void postgamemenu(void) { int count; int scoretemp; int scorecountdelay; int simtimer; int simcount; savereplay(game.levelnum+100); scoretemp=game.totalscore; scorecountdelay=0; simtimer=SDL_GetTicks(); resetmenuitems(); joymenunum=1; while (!menuitem[0].active && !menuitem[1].active && !windowinfo.shutdown) { glClearColor(0.0f,0.0f,0.0f,0.0f); glClear(GL_COLOR_BUFFER_BIT); numofmenuitems=0; createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_ESC); if (game.levelnum!=34) { createmenuitem(TXT_NEXTLEVEL,(640|TEXT_END),0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_N); } else { createmenuitem(TXT_ENDING,(640|TEXT_END),0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_N); } checksystemmessages(); checkkeyboard(); checkmouse(); checkjoystick(); checkmenuitems(); soundsimulation(view.position,view.orientation); setuptextdisplay(); glColor4f(1.0f,1.0f,1.0f,1.0f); displaybackground(580); drawbackground(468,(320|TEXT_CENTER),48,384,64,640,480); drawbackground(469,400,160,128,128,640,480); if (!game.bosslevel) { count=128; drawtext(TXT_SMALL_AMBER" /i///i",64,count,16,1.0f,1.0f,1.0f,1.0f,game.bonus[5],game.numofbonus[5]); count+=16; drawtext(TXT_MEDIUM_AMBER" /i///i",64,count,16,1.0f,1.0f,1.0f,1.0f,game.bonus[6],game.numofbonus[6]); count+=16; drawtext(TXT_LARGE_AMBER" /i///i",64,count,16,1.0f,1.0f,1.0f,1.0f,game.bonus[7],game.numofbonus[7]); count+=16; drawtext(TXT_TARBALLS" /i///i",64,count,16,1.0f,1.0f,1.0f,1.0f,game.bonus[4],game.numofbonus[4]); count+=16; drawtext(TXT_EXTRA_LIVES" /i///i",64,count,16,1.0f,1.0f,1.0f,1.0f,game.bonus[3],game.numofbonus[3]); count+=16; drawtext(TXT_SECRETS" /i///i",64,count,16,1.0f,1.0f,1.0f,1.0f,game.bonus[8],game.numofbonus[8]); count+=16; drawtext(TXT_LIFE_BONUS":/i",64,352,16,1.0f,1.0f,1.0f,1.0f,(object[0].hitpoints/50)*10); drawtext(TXT_LEVEL_POINTS":/i",64,368,16,1.0f,1.0f,1.0f,1.0f,game.score[0]-(object[0].hitpoints/50)*10); } else { if (game.levelnum==34 && game.exit==GAMEEXIT_WON) drawtext(TXT_GF_RESCUING_BONUS,64,336,16,1.0f,1.0f,1.0f,1.0f); drawtext(TXT_LIFE_BONUS":/i",64,352,16,1.0f,1.0f,1.0f,1.0f,(object[0].hitpoints/50)*10); if (game.levelnum==34 && game.exit==GAMEEXIT_WON) drawtext(TXT_BOSS_POINTS":/i",64,368,16,1.0f,1.0f,1.0f,1.0f,game.score[0]-(object[0].hitpoints/50)*10-1); else drawtext(TXT_BOSS_POINTS":/i",64,368,16,1.0f,1.0f,1.0f,1.0f,game.score[0]-(object[0].hitpoints/50)*10); } drawtext(TXT_TOTAL_POINTS":/i",64,384,16,1.0f,1.0f,1.0f,1.0f,scoretemp); drawtext("+/i",64+19*16,384,16,1.0f,1.0f,1.0f,1.0f,game.score[0]-(scoretemp-game.totalscore)); drawmenuitems(); drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f); SDL_GL_SwapBuffers(); simcount=0; while (SDL_GetTicks()-simtimer>20 && simcount<5) { simcount++; count=SDL_GetTicks()-simtimer-20; simtimer=SDL_GetTicks()-count; scorecountdelay++; if (scorecountdelay>=25) if (scoretemp<game.totalscore+game.score[0]) { if (scoretemp<=game.totalscore+game.score[0]-10) scoretemp+=10; else scoretemp++; if ((scorecountdelay&1)==1) playsound(15,view.position,NULL,0.2f,0,1.0f,-1,0); } } } if (menuitem[0].active) { game.exit=GAMEEXIT_EXITGAME; } for (count=numofsounds-1;count>=0;count--) deletesound(count); resetmenuitems(); }