void playLevelMusic() { int m=tmpscr->screen_midi; switch(m) { case -2: music_stop(); break; case -1: play_DmapMusic(); break; case 1: jukebox(ZC_MIDI_OVERWORLD); break; case 2: jukebox(ZC_MIDI_DUNGEON); break; case 3: jukebox(ZC_MIDI_LEVEL9); break; default: if(m>=4 && m<4+MAXCUSTOMMIDIS) jukebox(m-4+ZC_MIDI_COUNT); else music_stop(); } }
void jukebox(int index,int loop) { music_stop(); if(index<0) index=MAXMIDIS-1; if(index>=MAXMIDIS) index=0; music_stop(); // Allegro's DIGMID driver (the one normally used on on Linux) gets // stuck notes when a song stops. This fixes it. if(strcmp(midi_driver->name, "DIGMID")==0) set_volume(0, 0); set_volume(-1, mixvol(tunes[index].volume,midi_volume>>1)); play_midi((MIDI*)tunes[index].data,loop); if(tunes[index].start>0) midi_seek(tunes[index].start); midi_loop_end = tunes[index].loop_end; midi_loop_start = tunes[index].loop_start; currmidi=index; master_volume(digi_volume,midi_volume); midi_paused=false; }
void __cdecl FreeGameMem() { void *v0; // ecx void *v1; // ecx void *v2; // ecx void *v3; // ecx void *v4; // ecx music_stop(); v0 = pDungeonCels; pDungeonCels = 0; mem_free_dbg(v0); v1 = pMegaTiles; pMegaTiles = 0; mem_free_dbg(v1); v2 = *(void **)&dpiece_defs[0].blocks; *(_DWORD *)&dpiece_defs[0].blocks = 0; mem_free_dbg(v2); v3 = level_special_cel; level_special_cel = 0; mem_free_dbg(v3); v4 = pSpeedCels; pSpeedCels = 0; mem_free_dbg(v4); FreeMissiles(); FreeMonsters(); FreeObjectGFX(); FreeEffects(); FreeTownerGFX(); }
int load_pmdwin(const char* cszFileName) { music_stop(); int ret = music_load((char*)cszFileName); __android_log_print(ANDROID_LOG_DEBUG, "PMDWin", "music_load: %d", ret); switch(ret) { case PMDWIN_OK: case ERR_OPEN_PPC_FILE: case WARNING_PPC_ALREADY_LOAD: case ERR_OPEN_P86_FILE: case ERR_OPEN_PPS_FILE: case WARNING_PPS_ALREADY_LOAD: case ERR_OPEN_PPZ1_FILE: case ERR_OPEN_PPZ2_FILE: case WARNING_PPZ1_ALREADY_LOAD: case WARNING_PPZ2_ALREADY_LOAD: music_start(); return 1; case ERR_WRONG_PPC_FILE: case ERR_WRONG_PPZ1_FILE: case ERR_WRONG_PPZ2_FILE: case ERR_WRONG_P86_FILE: case ERR_OPEN_MUSIC_FILE: case ERR_WRONG_MUSIC_FILE: case ERR_OUT_OF_MEMORY: case ERR_OTHER: return 0; } }
void AI_Done(void) { music_stop(); FadeOut(2, pal, 10, 0, 0); memset(screen, 0x00, 64000); }
void GetTriforce::activate() { //get rid off all sprites but Link guys.clear(); items.clear(); Ewpns.clear(); Lwpns.clear(); Sitems.clear(); chainlinks.clear(); //decorations.clear(); if(!COOLSCROLL) show_subscreen_items=false; sfx(itemsbuf[triforceID].playsound); music_stop(); if(itemsbuf[triforceID].misc1) jukebox(itemsbuf[triforceID].misc1+ZC_MIDI_COUNT-1); else try_zcmusic((char*)"zelda.nsf",5, ZC_MIDI_TRIFORCE); if(itemsbuf[triforceID].flags & ITEM_GAMEDATA) game->lvlitems[dlevel]|=liTRIFORCE; }
int music_free(void) { int ret; unsigned to = 500000; cache_on(false); music_lock(); ret = -1; while (ret != 0) { ret = music_stop(); if (ret != 0) xrKernelDelayThread(100000); } g_list.is_list_playing = 0; g_thread_actived = 0; music_unlock(); free_shuffle_data(); if (xrKernelWaitThreadEnd(g_music_thread, &to) != 0) { xrKernelTerminateDeleteThread(g_music_thread); } else { xrKernelDeleteThread(g_music_thread); } xr_lock_destroy(&music_l); return 0; }
/* * intro_init() * Initializes the introduction scene */ void intro_init(void *foo) { elapsed_time = 0.0f; must_fadein = TRUE; music_stop(); bg = create_background(); in = input_create_user(NULL); }
int music_prev(void) { int ret = 0; music_lock(); switch (g_list.cycle_mode) { case conf_cycle_single: { if (g_list.curr_pos == 0) g_list.curr_pos = music_maxindex() - 1; else g_list.curr_pos--; break; } case conf_cycle_repeat: { if (g_list.curr_pos == 0) g_list.curr_pos = music_maxindex() - 1; else g_list.curr_pos--; break; } break; case conf_cycle_repeat_one: { if (g_list.curr_pos == 0) g_list.curr_pos = music_maxindex() - 1; else g_list.curr_pos--; break; } break; case conf_cycle_random: { if (shuffle_prev() != 0) { ret = music_stop(); g_list.is_list_playing = false; music_unlock(); return ret; } break; } break; } if (!g_list.is_list_playing) g_list.is_list_playing = true; if (g_list.is_list_playing) ret = music_play(g_list.curr_pos); music_unlock(); return ret; }
void title_init() { glEnable(GL_COLOR_MATERIAL); Image* image = loadBMP("img\\vrp.bmp"); _texture_id2 = texture_load_texture(image); delete image; menu_selected = 0; music_stop(0); music_play("test.ogg"); title_draw_scene_fadein(1); }
void cmd_music_on(int music) { // 0 is special case; stops playback if(music == 0) { music_stop(); return; } // Find file we want to play char filename[64]; switch(music) { case 0: music_stop(); break; case 1: get_filename_by_id(PSM_END, filename); break; case 2: get_filename_by_id(PSM_MENU, filename); break; case 3: get_filename_by_id(PSM_ARENA0, filename); break; case 4: get_filename_by_id(PSM_ARENA1, filename); break; case 5: get_filename_by_id(PSM_ARENA2, filename); break; case 6: get_filename_by_id(PSM_ARENA3, filename); break; case 7: get_filename_by_id(PSM_ARENA4, filename); break; } music_play(filename); music_set_volume(settings_get()->sound.music_vol/10.0f); }
void music_play(int n_music) { #ifndef NOSOUND #ifdef ARGS if (sound_arg) { #endif music_stop(); Mix_PlayMusic(music[n_music],-1); #ifdef ARGS } #endif #endif }
void music_play_fade(int n_music) { #ifndef NOSOUND #ifdef ARGS if (sound_arg) { #endif music_stop(); Mix_FadeInMusic(music[n_music],-1,2000); #ifdef ARGS } #endif #endif }
/* * Class: net_autch_android_s98droid_MS98NativeInterface * Method: ms98Deinit * Signature: ()V */ JNIEXPORT void JNICALL Java_net_autch_android_s98droid_MS98NativeInterface_ms98Deinit (JNIEnv *, jclass) { switch(select_synth) { case USE_S98: if(theFile != NULL) { delete theFile; theFile = NULL; } break; case USE_PMDWIN: music_stop(); } }
void __fastcall start_game(int uMsg) { cineflag = 0; zoomflag = 1; InitCursor(); InitLightTable(); LoadDebugGFX(); music_stop(); ShowProgress(uMsg); gmenu_init_menu(); InitLevelCursor(); sgnTimeoutCurs = 0; sgbMouseDown = 0; track_repeat_walk(0); }
int music_list_stop(void) { int ret; music_lock(); ret = music_stop(); if (ret < 0) { music_unlock(); return ret; } g_list.is_list_playing = false; g_list.first_time = true; music_unlock(); return ret; }
void GameOver::activate() { link.setAction(none); Playing=false; if(!debug_enabled) Paused=false; game->set_deaths(zc_min(game->get_deaths()+1,999)); link.dir=down; music_stop(); kill_sfx(); link.cancelAttack(); link.setHitTimer(0); link.setInvincible(false); link.scriptcoldet = 1; for(int i=0; i<16; i++) link.miscellaneous[i] = 0; //get rid off all sprites but Link guys.clear(); items.clear(); Ewpns.clear(); Lwpns.clear(); Sitems.clear(); chainlinks.clear(); decorations.clear(); playing_field_offset=56; // otherwise, red_shift() may go past the bottom of the screen quakeclk=wavy=0; //in original Z1, Link marker vanishes at death. //code in subscr.cpp, put_passive_subscr checks the following value. //color 255 is a GUI color, so quest makers shouldn't be using this value. //Also, subscreen is static after death in Z1. int tmp_link_dot = QMisc.colors.link_dot; QMisc.colors.link_dot = 255; //doesn't work //scrollbuf is tampered with by draw_screen() //put_passive_subscr(scrollbuf, &QMisc, 256, passive_subscreen_offset, false, false);//save this and reuse it. clear_bitmap(subscrbmp); put_passive_subscr(subscrbmp, &QMisc, 0, passive_subscreen_offset, false, sspUP); QMisc.colors.link_dot = tmp_link_dot; }
void pal_fade_to(unsigned to) { if(!to) music_stop(); while(bright!=to) { delay(4); if(bright<to) ++bright; else --bright; pal_bright(bright); } if(!bright) { ppu_off(); set_vram_update(0,0); scroll(0,0); } }
int music_load(int i) { struct music_file *file = music_get(i); int ret; char lyricname[PATH_MAX]; char lyricshortname[PATH_MAX]; if (file == NULL) return -EINVAL; ret = music_stop(); if (ret < 0) return ret; ret = music_setupdriver(file->shortpath->ptr, file->longpath->ptr); if (ret < 0) return ret; ret = music_load_config(); if (ret < 0) return ret; ret = musicdrv_load(file->shortpath->ptr, file->longpath->ptr); if (ret < 0) return ret; #ifdef ENABLE_LYRIC lyric_close(&lyric); if (tag_lyric && tag_lyric->used != 0) { lyric_open_raw(&lyric, tag_lyric->ptr, tag_lyric->used); buffer_free(tag_lyric); tag_lyric = NULL; } else { int lsize; strncpy_s(lyricname, NELEMS(lyricname), file->longpath->ptr, PATH_MAX); lsize = strlen(lyricname); lyricname[lsize - 3] = 'l'; lyricname[lsize - 2] = 'r'; lyricname[lsize - 1] = 'c'; if (fat_longnametoshortname(lyricshortname, lyricname, PATH_MAX)) lyric_open(&lyric, lyricshortname); } #endif return ret; }
void Review(char plr) { DrawReview(plr); music_start((plr == 0) ? M_PRES : M_RD); WaitForMouseUp(); while (1) { key = 0; GetMouse(); if (mousebuttons > 0 || key > 0) { /* Game Play */ if ((x >= 245 && y >= 5 && x <= 314 && y <= 17) || key == K_ENTER) { InBox(245, 5, 314, 17); WaitForMouseUp(); music_stop(); return; /* Done */ } } } }
/* * intro_update() * Updates the introduction scene */ void intro_update() { elapsed_time += timer_get_delta(); if(!fadefx_is_fading() && !must_fadein && (input_button_pressed(in, IB_FIRE3) || input_button_pressed(in, IB_FIRE4))) elapsed_time += INTRO_TIMEOUT; if(must_fadein) { fadefx_in(image_rgb(0,0,0), 1.0f); must_fadein = FALSE; } else if(elapsed_time >= INTRO_TIMEOUT) { if(fadefx_over()) { scenestack_pop(); load_intro_quest(); return; } fadefx_out(image_rgb(0,0,0), 1.0f); } if(music_is_playing()) music_stop(); }
void screen_credits () { if ( DEV > 1 ) return; music_stop(); displayOff(0); resetScreen(); VDP_setTextPalette ( PAL0 ); prepareColor ( 1, 0xfff ); prepareColor ( 2, 0x444 ); prepareColor ( 17, font_palette.data [ 7 ] ); prepareColor ( 18, font_palette.data [ 8 ] ); prepareColor ( 33, 0xfff ); prepareColor ( 34, 0x444 ); writeCredits ( 1, 4 ); writeCredits ( 2, 4 ); writeCredits ( 3, 9 ); //waitSc(2); }
int comms_setup() { printf("Loading comms...\n"); //todo: Passed in subject name, subject, portrait, disposition/bounty/resource need if (portrait_image == NULL) { portrait_image = Load_tex("sprites/portraits/sneeb_1.png"); } if (subject == NULL) { subject = Load_tex("sprites/gui/comms_subject_placeholder.png"); } if (comms_intro_text == NULL) { comms_intro_text = ">incoming signal from xornax 12"; } main_scene = SCENE_COMMS; frame_skip=0; comms_draw_count = 0; comms_setup_intro(); comms_set_current_npc_lines(); comms_load_player_choices(); SDL_SetRenderDrawColor(main_renderer, 0x00, 0x00, 0x00, 255); //TODO: Have a global vector of per-mode, per-faction, per-disposition(?) music tracks that we can pull stuff straight out of music_stop(500); music_loop_group(MUSIC_ROLE_COMMS, comms_faction, 0, -1); return 0; }
void Rush(char plr) { int i, R1, R2, R3, oR1, oR2, oR3, dgflag[3] = {0, 0, 0}; char pRush = 0; R1 = R2 = R3 = oR1 = oR2 = oR3 = 0; fCsh = 0; DrawRush(plr); pRush = (Data->P[plr].Cash >= 3) ? 1 : 0; fCsh = Data->P[plr].Cash; display::graphics.setForegroundColor(1); music_start((plr == 1) ? M_USMIL : M_USSRMIL); FadeIn(2, display::graphics.palette(), 10, 0, 0); WaitForMouseUp(); while (1) { key = 0; GetMouse(); if (mousebuttons > 0 || key > 0) { if (((y >= 32 && y <= 74 && x >= 280 && x <= 312 && mousebuttons > 0) || (key >= '1' && key <= '3')) && pRush && Data->P[plr].Mission[0].MissionCode && Data->P[plr].Mission[0].part != 1) { /* L1: Row One */ // R1=oR1; if (((y >= 49 && y <= 57 && mousebuttons > 0) || key == '2') && oR1 != 1 && fCsh < 3) { Help("i117"); } R1 = (((y >= 49 && y <= 57 && mousebuttons > 0) || key == '2') && fCsh >= 3) ? 1 : R1; if (((y >= 66 && y <= 74 && mousebuttons > 0) || key == '3') && oR1 != 2 && fCsh < 6) { Help("i117"); } R1 = (((y >= 66 && y <= 74 && mousebuttons > 0) || key == '3') && fCsh >= 6) ? 2 : R1; R1 = ((y >= 32 && y <= 40 && mousebuttons > 0) || key == '1') ? 0 : R1; if (oR1 != R1) { ResetRush(oR1, 0); SetRush(R1, 0); oR1 = R1; } } else if (((x >= 280 && x <= 312 && y >= 90 && y <= 132 && mousebuttons > 0) || (key >= '4' && key <= '6')) && pRush && Data->P[plr].Mission[1].MissionCode && Data->P[plr].Mission[1].part != 1) { /* L2: Row One */ // R2=oR2; if (((y >= 107 && y <= 115 && mousebuttons > 0) || key == '5') && oR2 != 1 && fCsh < 3) { Help("i117"); } R2 = (((y >= 107 && y <= 115 && mousebuttons > 0) || key == '5') && fCsh >= 3) ? 1 : R2; if (((y >= 124 && y <= 132 && mousebuttons > 0) || key == '6') && oR2 != 2 && fCsh < 6) { Help("i117"); } R2 = (((y >= 124 && y <= 132 && mousebuttons > 0) || key == '6') && fCsh >= 6) ? 2 : R2; R2 = ((y >= 90 && y <= 98 && mousebuttons > 0) || key == '4') ? 0 : R2; if (oR2 != R2) { ResetRush(oR2, 1); SetRush(R2, 1); oR2 = R2; } } else if (((x >= 280 && x <= 312 && y >= 148 && y <= 190 && mousebuttons > 0) || (key >= '7' && key <= '9')) && pRush && Data->P[plr].Mission[2].MissionCode && Data->P[plr].Mission[2].part != 1) { /* L3: Row One */ // R3=oR3; if (((y >= 165 && y <= 173 && mousebuttons > 0) || key == '8') && oR3 != 1 && fCsh < 3) { Help("i117"); } R3 = (((y >= 165 && y <= 173 && mousebuttons > 0) || key == '8') && fCsh >= 3) ? 1 : R3; if (((y >= 182 && y <= 190 && mousebuttons > 0) || key == '9') && oR3 != 2 && fCsh < 6) { Help("i117"); } R3 = (((y >= 182 && y <= 190 && mousebuttons > 0) || key == '9') && fCsh >= 6) ? 2 : R3; R3 = ((y >= 148 && y <= 156 && mousebuttons > 0) || key == '7') ? 0 : R3; if (oR3 != R3) { ResetRush(oR3, 2); SetRush(R3, 2); oR3 = R3; } }; // DOWNGRADE MISSION KEYBOARD if (key == 'Q' || key == 'R' || key == 'U') { if (key == 'Q') { i = 0; } else if (key == 'R') { i = 1; } else if (key == 'U') { i = 2; } else { i = 0; } if (Data->P[plr].Mission[i].MissionCode && Data->P[plr].Mission[i].part != 1) { InBox(91, 41 + i * 58, 264, 59 + i * 58); fill_rectangle(144, 29 + i * 58, 270, 37 + i * 58, 3); if (dg[Data->P[plr].Mission[i].MissionCode][dgflag[i]] != 0) { fill_rectangle(93, 43 + i * 58, 262, 57 + i * 58, 3); display::graphics.setForegroundColor(5); GetMisType(dg[Data->P[plr].Mission[i].MissionCode][dgflag[i]]); draw_string(96, 48 + 58 * i, Mis.Abbr); if (Mis.Dur >= 1) { switch (Data->P[plr].Mission[i].Duration) { case 1: draw_string(0, 0, ""); break; case 2: draw_string(0, 0, " (B)"); break; case 3: draw_string(0, 0, " (C)"); break; case 4: draw_string(0, 0, " (D)"); break; case 5: draw_string(0, 0, " (E)"); break; case 6: draw_string(0, 0, " (F)"); break; default: draw_string(0, 0, ""); break; } } //Missions(plr,96,48+58*i,dg[Data->P[plr].Mission[i].MissionCode][dgflag[i]],0); dgflag[i]++; fill_rectangle(191, 71 + i * 58, 270, 78 + i * 58, 3); display::graphics.setForegroundColor(9); draw_string(145, 33 + i * 58, "DOWNGRADED MISSION"); draw_string(193, 77 + i * 58, "-3 PRESTIGE"); } else { dgflag[i] = 0; fill_rectangle(93, 43 + i * 58, 262, 57 + i * 58, 3); display::graphics.setForegroundColor(5); GetMisType(Data->P[plr].Mission[i].MissionCode); draw_string(96, 48 + 58 * i, Mis.Abbr); if (Mis.Dur >= 1) { switch (Data->P[plr].Mission[i].Duration) { case 1: draw_string(0, 0, ""); break; case 2: draw_string(0, 0, " (B)"); break; case 3: draw_string(0, 0, " (C)"); break; case 4: draw_string(0, 0, " (D)"); break; case 5: draw_string(0, 0, " (E)"); break; case 6: draw_string(0, 0, " (F)"); break; default: draw_string(0, 0, ""); break; } } //Missions(plr,96,48+58*i,Data->P[plr].Mission[i].MissionCode,0); fill_rectangle(191, 71 + i * 58, 270, 78 + i * 58, 3); if (Data->P[plr].Mission[i].Name[24] == 1) { display::graphics.setForegroundColor(9); draw_string(145, 33 + i * 58, "DOWNGRADED MISSION"); draw_string(193, 77 + i * 58, "-3 PRESTIGE"); } else { display::graphics.setForegroundColor(7); draw_string(145, 33 + i * 58, "ORIGINAL MISSION"); draw_string(193, 77 + i * 58, "NO PENALTY"); } //display::graphics.setForegroundColor(7); //draw_string(145,33+i*58,"ORIGINAL MISSION"); //draw_string(193,77+i*58,"NO PENALTY"); } WaitForMouseUp(); OutBox(91, 41 + i * 58, 264, 59 + i * 58); } }; for (i = 0; i < 3; i++) { if (x >= 91 && x <= 264 && y >= 41 + i * 59 && y <= 59 + i * 59 && mousebuttons > 0 && Data->P[plr].Mission[i].MissionCode && Data->P[plr].Mission[i].part != 1) { // Downgrade InBox(91, 41 + i * 58, 264, 59 + i * 58); fill_rectangle(144, 29 + i * 58, 270, 37 + i * 58, 3); if (dg[Data->P[plr].Mission[i].MissionCode][dgflag[i]] != 0) { fill_rectangle(93, 43 + i * 58, 262, 57 + i * 58, 3); display::graphics.setForegroundColor(5); GetMisType(dg[Data->P[plr].Mission[i].MissionCode][dgflag[i]]); draw_string(96, 48 + 58 * i, Mis.Abbr); if (Mis.Dur >= 1) { switch (Data->P[plr].Mission[i].Duration) { case 1: draw_string(0, 0, ""); break; case 2: draw_string(0, 0, " (B)"); break; case 3: draw_string(0, 0, " (C)"); break; case 4: draw_string(0, 0, " (D)"); break; case 5: draw_string(0, 0, " (E)"); break; case 6: draw_string(0, 0, " (F)"); break; default: draw_string(0, 0, ""); break; } } //Missions(plr,96,48+58*i,dg[Data->P[plr].Mission[i].MissionCode][dgflag[i]],0); dgflag[i]++; fill_rectangle(191, 71 + i * 58, 270, 78 + i * 58, 3); display::graphics.setForegroundColor(9); draw_string(145, 33 + i * 58, "DOWNGRADED MISSION"); draw_string(193, 77 + i * 58, "-3 PRESTIGE"); } else { dgflag[i] = 0; fill_rectangle(93, 43 + i * 58, 262, 57 + i * 58, 3); display::graphics.setForegroundColor(5); GetMisType(Data->P[plr].Mission[i].MissionCode); draw_string(96, 48 + 58 * i, Mis.Abbr); if (Mis.Dur >= 1) { switch (Data->P[plr].Mission[i].Duration) { case 1: draw_string(0, 0, ""); break; case 2: draw_string(0, 0, " (B)"); break; case 3: draw_string(0, 0, " (C)"); break; case 4: draw_string(0, 0, " (D)"); break; case 5: draw_string(0, 0, " (E)"); break; case 6: draw_string(0, 0, " (F)"); break; default: draw_string(0, 0, ""); break; } } //Missions(plr,96,48+58*i,Data->P[plr].Mission[i].MissionCode,0); fill_rectangle(191, 71 + i * 58, 270, 78 + i * 58, 3); if (Data->P[plr].Mission[i].Name[24] == 1) { display::graphics.setForegroundColor(9); draw_string(145, 33 + i * 58, "DOWNGRADED MISSION"); draw_string(193, 77 + i * 58, "-3 PRESTIGE"); } else { display::graphics.setForegroundColor(7); draw_string(145, 33 + i * 58, "ORIGINAL MISSION"); draw_string(193, 77 + i * 58, "NO PENALTY"); } //display::graphics.setForegroundColor(7); //draw_string(145,33+i*58,"ORIGINAL MISSION"); //draw_string(193,77+i*58,"NO PENALTY"); } WaitForMouseUp(); OutBox(91, 41 + i * 58, 264, 59 + i * 58); } }; if ((x >= 245 && y >= 5 && x <= 314 && y <= 17 && mousebuttons > 0) || key == K_ENTER) { // CONTINUE InBox(245, 5, 314, 17); WaitForMouseUp(); if (key > 0) { delay(150); } OutBox(245, 5, 314, 17); delay(10); for (i = 0; i < 3; i++) { if (Data->P[plr].Mission[i].MissionCode) { if (dgflag[i] != 0) { Data->P[plr].Mission[i].MissionCode = dg[Data->P[plr].Mission[i].MissionCode][dgflag[i] - 1]; pNeg[plr][i] = 1; } } } if (Data->P[plr].Mission[1].part == 1) { R2 = R1; } if (Data->P[plr].Mission[2].part == 1) { R3 = R2; } if (Data->P[plr].Mission[0].MissionCode && Data->P[plr].Cash >= 3 * R1) { Data->P[plr].Cash -= 3 * R1; Data->P[plr].Mission[0].Month -= R1; Data->P[plr].Mission[0].Rushing = R1; }; if (Data->P[plr].Mission[1].MissionCode && Data->P[plr].Cash >= 3 * R2) { Data->P[plr].Cash -= 3 * R2; Data->P[plr].Mission[1].Month -= R2; Data->P[plr].Mission[1].Rushing = R2; }; if (Data->P[plr].Mission[2].MissionCode && Data->P[plr].Cash >= 3 * R3) { Data->P[plr].Cash -= 3 * R3; Data->P[plr].Mission[2].Month -= R3; Data->P[plr].Mission[2].Rushing = R3; } music_stop(); return; // Done } } } }
void Limbo(char plr) { int i, AstroList[100], BarA, count, now2, tag = 0; memset(AstroList, -1, sizeof AstroList); DrawLimbo(plr); music_start((plr == 0) ? M_ASTTRNG : M_ASSEMBLY); now2 = BarA = count = 0; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); for (i = 0; i < Data->P[plr].AstroCount; i++) if (Data->P[plr].Pool[i].Status == AST_ST_ACTIVE && Data->P[plr].Pool[i].Assign == 0) { AstroList[count++] = i; }; DispLeft(plr, BarA, count, now2, &AstroList[0]); if (count > 0) { LimboText(plr, AstroList[now2]); } FadeIn(2, 10, 0, 0); while (1) { key = 0; WaitForMouseUp(); key = 0; GetMouse(); //Mouse ManSelect from being Clicked on for (i = 0; i < 8; i++) { if (x >= 27 && y >= (131 + i * 8) && x <= 151 && y <= (137 + i * 8) && mousebuttons > 0 && (now2 - BarA + i) <= (count - 1)) { now2 -= BarA; now2 += i; BarA = i; fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &AstroList[0]); LimboText(plr, AstroList[now2]); WaitForMouseUp(); } } // Left Arrow Up if ((mousebuttons > 0 && x >= 6 && y >= 130 && x <= 18 && y <= 161 && count > 0) || key == UP_ARROW) { InBox(6, 130, 18, 161); for (i = 0; i < 50; i++) { key = 0; GetMouse(); delay(10); if (mousebuttons == 0) { if (BarA == 0 && now2 > 0) { now2--; fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &AstroList[0]); LimboText(plr, AstroList[now2]); }; if (BarA > 0) { fill_rectangle(26, 129, 153, 195, 0); BarA--; now2--; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &AstroList[0]); LimboText(plr, AstroList[now2]); }; i = 51; } } while (mousebuttons == 1 || key == UP_ARROW) { delay(100); if (BarA == 0 && now2 > 0) { now2--; fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &AstroList[0]); LimboText(plr, AstroList[now2]); }; if (BarA > 0) { fill_rectangle(26, 129, 153, 195, 0); BarA--; now2--; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &AstroList[0]); LimboText(plr, AstroList[now2]); }; key = 0; GetMouse(); } //WaitForMouseUp();key=0; OutBox(6, 130, 18, 161); delay(10); }; // Left Arrow Down if ((mousebuttons > 0 && x >= 6 && y >= 163 && x <= 18 && y <= 194 && count > 0) || key == DN_ARROW) { InBox(6, 163, 18, 194); for (i = 0; i < 50; i++) { key = 0; GetMouse(); delay(10); if (mousebuttons == 0) { if (BarA == 7 && (now2 < count - 1)) { now2++; fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &AstroList[0]); LimboText(plr, AstroList[now2]); }; if (BarA < 7 && now2 < count - 1) { fill_rectangle(26, 129, 153, 195, 0); BarA++; now2++; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &AstroList[0]); LimboText(plr, AstroList[now2]); }; i = 51; } } while (mousebuttons == 1 || key == DN_ARROW) { delay(100); if (BarA == 7 && (now2 < count - 1)) { now2++; fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &AstroList[0]); LimboText(plr, AstroList[now2]); }; if (BarA < 7 && now2 < count - 1) { fill_rectangle(26, 129, 153, 195, 0); BarA++; now2++; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &AstroList[0]); LimboText(plr, AstroList[now2]); }; key = 0; GetMouse(); } //key=0;WaitForMouseUp();key=0; OutBox(6, 163, 18, 194); delay(10); }; // Continue if ((mousebuttons > 0 && x >= 245 && y >= 5 && x <= 314 && y <= 17) || key == K_ENTER) { InBox(245, 5, 314, 17); WaitForMouseUp(); if (key > 0) { delay(150); } OutBox(245, 5, 314, 17); music_stop(); return; } // Select Transfer Button if ((mousebuttons > 0 && x >= 167 && y >= 48 && x <= 239 && y <= 65) || key == LT_ARROW) { tag = 0; InBox(167, 48, 239, 65); OutBox(241, 48, 313, 65); fill_rectangle(166, 78, 314, 88, 10); display::graphics.setForegroundColor(11); draw_string(185, 85, "TRANSFER TO LOCATION"); } // Select Visit To Button if ((mousebuttons > 0 && x >= 241 && y >= 48 && x <= 313 && y <= 65) || key == RT_ARROW) { tag = 1; InBox(241, 48, 313, 65); OutBox(167, 48, 239, 65); fill_rectangle(166, 78, 314, 88, 10); display::graphics.setForegroundColor(11); draw_string(203, 85, "VISIT LOCATION"); } // Selection Loops for (i = 0; i < 5; i++) { // Program Transfer if ((tag == 0 && Data->P[plr].Manned[i].Num >= 0) && ((mousebuttons > 0 && x >= 167 && y >= (95 + 21 * i) && x <= 236 && y <= (109 + 21 * i)) || key == 0x0030 + i)) { InBox(167, 95 + 21 * i, 236, 109 + 21 * i); if (key > 0) { delay(140); } WaitForMouseUp(); key = 0; OutBox(167, 95 + 21 * i, 236, 109 + 21 * i); Data->P[plr].Pool[AstroList[now2]].Assign = i + 1; Data->P[plr].Pool[AstroList[now2]].Unassigned = 0; Data->P[plr].Pool[AstroList[now2]].Moved = 0; for (i = now2; i < count; i++) { AstroList[i] = AstroList[i + 1]; } AstroList[i] = -1; count--; if (count == 0) { fill_rectangle(10, 52, 89, 101, 7 + plr * 3); Clear(); } if (now2 == count) { if (now2 > 0) { now2--; } if (BarA > 0) { BarA--; } }; fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &AstroList[0]); if (count > 0) { LimboText(plr, AstroList[now2]); } } // Program Visit if ((tag == 1 && Data->P[plr].Manned[i].Num >= 0) && ((mousebuttons > 0 && x >= 167 && y >= (95 + 21 * i) && x <= 236 && y <= (109 + 21 * i)) || key == 0x0030 + i)) { InBox(167, 95 + 21 * i, 236, 109 + 21 * i); if (key > 0) { delay(140); } WaitForMouseUp(); key = 0; OutBox(167, 95 + 21 * i, 236, 109 + 21 * i); music_stop(); Programs(plr, i + 1); DrawLimbo(plr); music_start((plr == 0) ? M_ASTTRNG : M_ASSEMBLY); InBox(241, 48, 313, 65); OutBox(167, 48, 239, 65); fill_rectangle(166, 78, 314, 88, 10); display::graphics.setForegroundColor(11); draw_string(203, 85, "VISIT LOCATION"); fill_rectangle(26, 129, 153, 195, 0); now2 = BarA = count = 0; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); for (i = 0; i < Data->P[plr].AstroCount; i++) if (Data->P[plr].Pool[i].Status == AST_ST_ACTIVE && Data->P[plr].Pool[i].Assign == 0) { AstroList[count++] = i; } DispLeft(plr, BarA, count, now2, &AstroList[0]); if (count > 0) { LimboText(plr, AstroList[now2]); } // ShBox(26,130+BarA*8,152,138+BarA*8); // DispLeft(plr,BarA,count,now2,&AstroList[0]); // LimboText(plr,AstroList[now2]); FadeIn(2, 10, 0, 0); } // Training Transfer if ((tag == 0 && count > 0) && ((mousebuttons > 0 && x >= 244 && y >= (95 + 21 * i) && x <= 313 && y <= (109 + 21 * i)) || key == 0x0035 + i)) { InBox(244, 95 + 21 * i, 313, 109 + 21 * i); if (key > 0) { delay(140); } WaitForMouseUp(); key = 0; OutBox(244, 95 + 21 * i, 313, 109 + 21 * i); skilLev = 0; // Figure out relevant skill level bfr sending to Adv Training -Leon if (i == 0) { skilLev = Data->P[plr].Pool[AstroList[now2]].Cap; } if (i == 1) { skilLev = Data->P[plr].Pool[AstroList[now2]].LM; } if (i == 2) { skilLev = Data->P[plr].Pool[AstroList[now2]].EVA; } if (i == 3) { skilLev = Data->P[plr].Pool[AstroList[now2]].Docking; } if (i == 4) { skilLev = Data->P[plr].Pool[AstroList[now2]].Endurance; } display::graphics.setForegroundColor(2); if (Data->P[plr].Pool[AstroList[now2]].TrainingLevel > 6) { Help("i120"); } else if (skilLev > 3) { OutBox(244, 95 + 21 * i, 313, 109 + 21 * i); // If they have a 4 in that skill, don't send to Adv Training for it } else if (Data->P[plr].Cash < 3) { Help("i121"); } else { if (skilLev > 2) { // If they have a 3 in that skill, send them directly to Adv III and charge just 2MB Data->P[plr].Pool[AstroList[now2]].Status = AST_ST_TRAIN_ADV_3; Data->P[plr].Cash -= 2; } else { Data->P[plr].Pool[AstroList[now2]].Status = AST_ST_TRAIN_ADV_1; Data->P[plr].Cash -= 3; } Data->P[plr].Pool[AstroList[now2]].Focus = i + 1; Data->P[plr].Pool[AstroList[now2]].Assign = 0; Data->P[plr].Pool[AstroList[now2]].Unassigned = 0; Data->P[plr].Pool[AstroList[now2]].Moved = 0; for (i = now2; i < count; i++) { AstroList[i] = AstroList[i + 1]; } AstroList[i] = -1; count--; if (count == 0) { fill_rectangle(10, 52, 89, 101, 7 + plr * 3); Clear(); } if (now2 == count) { if (now2 > 0) { now2--; } if (BarA > 0) { BarA--; } }; fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &AstroList[0]); if (count > 0) { LimboText(plr, AstroList[now2]); } } // else } // if adv training // Training Visit if (tag == 1 && ((mousebuttons > 0 && x >= 244 && y >= (95 + 21 * i) && x <= 313 && y <= (109 + 21 * i)) || key == 0x0035 + i)) { InBox(244, 95 + 21 * i, 313, 109 + 21 * i); if (key > 0) { delay(140); } WaitForMouseUp(); key = 0; OutBox(244, 95 + 21 * i, 313, 109 + 21 * i); music_stop(); Train(plr, i + 1); DrawLimbo(plr); music_start((plr == 0) ? M_ASTTRNG : M_ASSEMBLY); fill_rectangle(166, 78, 314, 88, 10); display::graphics.setForegroundColor(11); draw_string(203, 85, "VISIT LOCATION"); InBox(241, 48, 313, 65); OutBox(167, 48, 239, 65); fill_rectangle(26, 129, 153, 195, 0); now2 = BarA = count = 0; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); for (i = 0; i < Data->P[plr].AstroCount; i++) if (Data->P[plr].Pool[i].Status == AST_ST_ACTIVE && Data->P[plr].Pool[i].Assign == 0) { AstroList[count++] = i; } DispLeft(plr, BarA, count, now2, &AstroList[0]); if (count > 0) { LimboText(plr, AstroList[now2]); } FadeIn(2, 10, 0, 0); } } }; /* end while */ } /* end Limbo */
/* * Class: net_autch_android_s98droid_PMDWinNativeInterface * Method: pmdwinDeinit * Signature: ()V */ JNIEXPORT void JNICALL Java_net_autch_android_s98droid_PMDWinNativeInterface_pmdwinDeinit (JNIEnv *, jclass) { music_stop(); }
/** * @brief Displays the introduction sequence. * * @brief text Path of text file to use. * @brief mus Type of music to use (run through music.lua). * @return 0 on success. */ int intro_display( const char *text, const char *mus ) { double offset; /* distance from bottom of the top line. */ double line_height; /* # pixels per line. */ int lines_per_screen; /* max appearing lines on the screen. */ scroll_buf_t *sb_arr; /* array of lines to render. */ scroll_buf_t *sb_list; /* list " " " " */ double vel = 16.; /* velocity: speed of text. */ int stop = 0; /* stop the intro. */ unsigned int tcur, tlast; /* timers. */ double delta; /* time diff from last render to this one. */ int line_index = 0; /* index into the big list of intro lines. */ intro_img_t side_image; /* image to go along with the text. */ intro_img_t transition; /* image for transitioning. */ /* Load the introduction. */ if (intro_load(text) < 0) return -1; /* Change music to intro music. */ if (mus != NULL) music_choose(mus); /* We need to clear key repeat to avoid infinite loops. */ toolkit_clearKey(); /* Enable keyrepeat just for the intro. */ SDL_EnableKeyRepeat( conf.repeat_delay, conf.repeat_freq ); /* Do a few calculations to figure out how many lines can be present on the screen at any given time. */ line_height = (double)intro_font.h * 1.3; lines_per_screen = (int)(SCREEN_H / line_height + 1.5); /* round up + 1 */ sb_arr = (scroll_buf_t*)malloc( sizeof(scroll_buf_t) * lines_per_screen ); /* Force the first line to be loaded immediately. */ offset = line_height; /* Create a cycle of lines. */ sb_list = arrange_scroll_buf( sb_arr, lines_per_screen ); /* Unset the side image. */ initialize_image( &side_image ); initialize_image( &transition ); tlast = SDL_GetTicks(); while (!stop) { tcur = SDL_GetTicks(); delta = (double)(tcur - tlast) / 1000.; tlast = tcur; /* Increment position. */ offset += vel * delta; while (! (offset < line_height)) { /* One line has scrolled off, and another one on. */ if (line_index < intro_nlines) { switch (intro_lines[line_index][0]) { case 't': /* plain ol' text. */ sb_list->text = &intro_lines[line_index][1]; offset -= line_height; sb_list = sb_list->next; break; case 'i': /* fade in image. */ intro_fade_image_in( &side_image, &transition, &intro_lines[line_index][1] ); break; case 'o': /* fade out image. */ if (NULL == side_image.tex) { WARN("Tried to fade out without an image." ); break; } side_image.fade_rate = -0.1; side_image.c.a = 0.99; break; default: /* unknown. */ break; } ++line_index; } else { sb_list->text = NULL; offset -= line_height; sb_list = sb_list->next; } } /* while (offset > line_height) */ /* Fade the side image. */ if (side_image.tex != NULL && side_image.c.a < 1.0) { side_image.c.a += delta * vel * side_image.fade_rate; if (transition.tex != NULL && transition.fade_rate > 0.0) { transition.c.a += delta * vel * transition.fade_rate; } if (side_image.c.a > 1.0) { /* Faded in... */ side_image.c.a = 1.0; side_image.fade_rate = 0.0; } else if (side_image.c.a < 0.0) { /* Faded out... */ gl_freeTexture( side_image.tex ); if (transition.tex != NULL) { side_image.tex = transition.tex; side_image.c.a = transition.c.a; side_image.y = transition.y; side_image.fade_rate = 0.1; transition.tex = NULL; transition.c.a = 1.0; } else { side_image.c.a = 1.0; side_image.tex = NULL; side_image.fade_rate = 0.0; } } } /* Clear stuff. */ glClear(GL_COLOR_BUFFER_BIT); /* Only thing we actually care about updating is music. */ music_update( 0. ); /* Draw text. */ stop = intro_draw_text( sb_list, offset, line_height ); if (NULL != side_image.tex) { /* Draw the image next to the text. */ gl_blitScale( side_image.tex, side_image.x, side_image.y, side_image.tex->w, side_image.tex->h, &side_image.c ); } if (NULL != transition.tex && transition.c.a > 0.0) { /* Draw the image in transition. */ gl_blitScale( transition.tex, transition.x, transition.y, transition.tex->w, transition.tex->h, &transition.c ); } /* Display stuff. */ SDL_GL_SwapBuffers(); SDL_Delay(10); /* No need to burn CPU. */ /* Handle user events. */ intro_event_handler( &stop, &offset, &vel ); } /* while (!stop) */ /* free malloc'd memory. */ free( sb_arr ); if (NULL != side_image.tex) { gl_freeTexture( side_image.tex ); } if (NULL != transition.tex) { gl_freeTexture( transition.tex ); } /* Disable intro's key repeat. */ SDL_EnableKeyRepeat( 0, 0 ); /* Stop music, normal music will start shortly after. */ music_stop(); /* Clean up after the introduction. */ intro_cleanup(); return 0; }
void Museum(char plr) { int i, tots = 7, beg; char AName[7][22] = {"DIRECTOR RANKING", "SPACE HISTORY", "MISSION RECORDS", "PRESTIGE SUMMARY", "HARDWARE EFFICIENCY", "ASTRONAUT HISTORY", "EXIT THE MUSEUM" }; char AImg[7] = {8, 9, 10, 11, 13, 14, 0}; if (Data->P[plr].AstroCount == 0) { memcpy(&AName[5][0], &AName[6][0], 22); // move up Exit AImg[5] = AImg[6]; tots = 6; } else if (plr == 1) { strncpy(&AName[5][0], "COSMO", 5); } AImg[3] += plr; // FadeOut(2,pal,10,0,0); music_start(M_THEME); beg = 0; do { if (beg == 0) { beg = (Data->P[plr].AstroCount > 0) ? 7 : 6; // mods for astros } else { FadeOut(2, display::graphics.palette(), 10, 0, 0); DrawSpaceport(plr); PortPal(plr); fill_rectangle(166, 191, 318, 198, 3); display::graphics.setForegroundColor(0); draw_string(257, 197, "CASH:"); draw_megabucks(285, 197, Data->P[plr].Cash); display::graphics.setForegroundColor(11); draw_string(256, 196, "CASH:"); draw_megabucks(284, 196, Data->P[plr].Cash); display::graphics.setForegroundColor(0); if (Data->Season == 0) { draw_string(166, 197, "SPRING 19"); } else { draw_string(166, 197, "FALL 19"); } draw_number(0, 0, Data->Year); display::graphics.setForegroundColor(11); if (Data->Season == 0) { draw_string(165, 196, "SPRING 19"); } else { draw_string(165, 196, "FALL 19"); } draw_number(0, 0, Data->Year); FadeIn(2, display::graphics.palette(), 10, 0, 0); } helpText = (plr == 0) ? "i700" : "i701"; keyHelpText = (plr == 0) ? "k603" : "k604"; i = BChoice(plr, tots, &AName[0][0], &AImg[0]); switch (i) { case 1: RankMe(plr); break; case 2: helpText = "i130"; keyHelpText = "k031"; ShowSpHist(plr); break; case 3: helpText = "i131"; keyHelpText = "k321"; Records(plr); break; case 4: helpText = "i132"; keyHelpText = "k033"; ShowPrest(plr); break; case 5: helpText = "i034"; ShowHard(plr); break; case 6: helpText = (plr == 0) ? "i133" : "i134"; keyHelpText = (plr == 0) ? "k035" : "k441"; if (Data->P[plr].AstroCount > 0) { ShowAstrosHist(plr); } break; case 7: default: break; } helpText = "i000"; keyHelpText = "k000"; } while (i != beg); music_stop(); return; }
// Start playing the given track void music_start_loop(enum music_track track, int loop) { OSStatus result; // Load as necessary music_load(track); // Ensure we can we play this if (!music_files[track].sequence_loaded) return; // Keep track of if we should loop or not music_files[track].loop = loop; // Is this already playing, or would it be playing if we weren't muted? if (music_files[track].playing || music_files[track].muted) return; // TODO: fix the code that calls the music system so that we don't have two tracks running at once // For now, stop any other tracks music_stop(); // If we're muted, mark this track as muted, and bail out if (mute_music) { music_files[track].muted = 1; return; } // Initialize the music player and attach the sequence require_noerr(result = NewMusicPlayer(&music_files[track].player), fail); require_noerr(result = MusicPlayerSetSequence(music_files[track].player, music_files[track].sequence), fail); // Determine the track length if we don't know it already if (music_files[track].track_length <= 1.0) { UInt32 track_count, i; require_noerr(result = MusicSequenceGetTrackCount(music_files[track].sequence, &track_count), fail); for (i = 0; i < track_count; i++) { MusicTrack midi_track; MusicTimeStamp track_length; UInt32 property_size = sizeof(MusicTimeStamp); // Get the track within the MIDI file require_noerr(result = MusicSequenceGetIndTrack(music_files[track].sequence, i, &midi_track), fail); // Determine its length require_noerr(result = MusicTrackGetProperty(midi_track, kSequenceTrackProperty_TrackLength, &track_length, &property_size), fail); // Update the music track length if this MIDI track is longer if (track_length > music_files[track].track_length) music_files[track].track_length = track_length; } } // Seek and pre-roll to the beginning require_noerr(result = MusicPlayerSetTime(music_files[track].player, 0), fail); require_noerr(result = MusicPlayerPreroll(music_files[track].player), fail); // Start playing require_noerr(result = MusicPlayerStart(music_files[track].player), fail); // Mark as playing music_files[track].playing = 1; return; fail: WARNING2("unexpected error playing MIDI track; result=%ld", result); music_files[track].unplayable = 1; return; }
/** * @brief Displays the introduction sequence. * * @brief text Path of text file to use. * @brief mus Type of music to use (run through music.lua). * @return 0 on success. */ int intro_display( const char *text, const char *mus ) { int i, max; unsigned int tcur, tlast; double dt; double x, y, vel; double offset; double density; SDL_Event event; /* Load the introduction. */ if (intro_load(text) < 0) return -1; /* Calculate velocity. */ density = ((double)intro_length / (double)intro_nlines); /* char / line */ density /= (double)intro_font.h; /* char / pixel */ vel = INTRO_SPEED / density; /* (char / s) * (pixel / char) = pixel / s */ /* Change music to intro music. */ if (mus != NULL) music_choose(mus); /* We need to clear key repeat to avoid infinite loops. */ toolkit_clearKey(); /* Prepare for intro loop. */ x = 100.; y = 0.; tlast = SDL_GetTicks(); offset = 0.; max = intro_nlines + SCREEN_H / ((intro_font.h + 5.)); while (1) { /* Get delta tick in seconds. */ tcur = SDL_GetTicks(); dt = (double)(tcur - tlast) / 1000.; tlast = tcur; /* Handle events. */ while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_KEYDOWN: /* Escape skips directly. */ if (event.key.keysym.sym == SDLK_ESCAPE) offset = max * (intro_font.h + 5.); /* Only Handle space from here down. */ else if (!nstd_isspace(event.key.keysym.sym)) break; /* Purpose fallthrough. */ case SDL_JOYBUTTONDOWN: offset += 250.; default: break; } } /* Increment position. */ offset += vel * dt; /* Clear stuff. */ glClear(GL_COLOR_BUFFER_BIT); /* Draw the text. */ i = (int)(offset / (intro_font.h + 5.)); if (i > max) /* Out of lines. */ break; y = offset - (i+1) * (intro_font.h + 5.); while (i >= 0) { /* Skip in line isn't valid. */ if (i >= intro_nlines) { i--; y += intro_font.h + 5.; continue; } gl_print( &intro_font, x, y, &cConsole, intro_lines[i] ); /* Increment line and position. */ i--; y += intro_font.h + 5.; } /* Only thing we actually care about updating is music. */ music_update(); /* Display stuff. */ SDL_GL_SwapBuffers(); SDL_Delay(10); /* No need to burn CPU. */ } /* Stop music, normal music will start shortly after. */ music_stop(); /* Clean up after the introduction. */ intro_cleanup(); return 0; }