void SMK_playFlic(char *path) { #if 0 int frames=0,i; if (access(path,F_OK) != 0) { return; } if (!noSoundFlag) { smk=SmackOpen(path,SMACKTRACKS,SMACKAUTOEXTRA); } else { smk=SmackOpen(path,0,SMACKAUTOEXTRA); } if (smk) { GFX_fadeOut(255); // make sure game palette is faded walock[SMACKTILE]=200; allocache(&waloff[SMACKTILE],320L*200L,&walock[SMACKTILE]); tilesizx[SMACKTILE]=200; tilesizy[SMACKTILE]=320; SmackToBuffer(smk,0L,0L,320L,200L,(void *)waloff[SMACKTILE],0); keystatus[1]=0; keystatus[28]=0; keystatus[57]=0; while (1) { if (smk->NewPalette) { SMK_loadPalette(smk->Palette); } SmackDoFrame(smk); SmackNextFrame(smk); rotatesprite(320L<<15,200L<<15,65536L,512,SMACKTILE,0,0,2+4+64, 0L,0L,xdim-1L,ydim-1L); nextpage(); SMK_setPalette(); while (SmackWait(smk)) { if (keystatus[1] || keystatus[57] || keystatus[28]) { goto done; } } if (keystatus[1] || keystatus[57] || keystatus[28]) { goto done; } frames++; if (frames == smk->Frames) { goto done; } } done: walock[SMACKTILE]=1; SmackClose(smk); for (i = 0 ; i < MAXRADBUFFS ; i++) { radbuf[i].cache_lock=1; } } #endif }
void GAME_drawosdchar(int x, int y, char ch, int shade, int pal) { short ac; if (ch == 32) return; ac = ch-'!'+STARTALPHANUM; if (ac < STARTALPHANUM || ac > ENDALPHANUM) return; rotatesprite(((x<<3)+x)<<16, (y<<3)<<16, 65536l, 0, ac, shade, pal, 8|16, 0, 0, xdim-1, ydim-1); }
void GAME_drawosdcursor(int x, int y, int type, int lastkeypress) { short ac; if (type) ac = SMALLFNTCURSOR; else ac = '_'-'!'+STARTALPHANUM; if (!((GetTime()-lastkeypress) & 0x40l)) rotatesprite(((x<<3)+x)<<16, ((y<<3)+(type?-1:2))<<16, 65536l, 0, ac, 0, 8, 8|16, 0, 0, xdim-1, ydim-1); }
void GAME_clearbackground(int c, int r) { long x, y, xsiz, ysiz, tx2, ty2; long daydim, bits; if (getrendermode() < 3) bits = BITS; else bits = BITSTL; daydim = r<<3; xsiz = tilesizx[BGTILE]; tx2 = xdim/xsiz; ysiz = tilesizy[BGTILE]; ty2 = daydim/ysiz; for(x=0;x<=tx2;x++) for(y=0;y<=ty2;y++) rotatesprite(x*xsiz<<16,y*ysiz<<16,65536L,0,BGTILE,SHADE,PALETTE,bits,0,0,xdim,daydim); xsiz = tilesizy[BORDTILE]; tx2 = xdim/xsiz; ysiz = tilesizx[BORDTILE]; for(x=0;x<=tx2;x++) rotatesprite(x*xsiz<<16,(daydim+ysiz+1)<<16,65536L,1536,BORDTILE,SHADE-12,PALETTE,BITS,0,0,xdim,daydim+ysiz+1); }
void GAME_drawosdstr(int x, int y, char *ch, int len, int shade, int pal) { short ac; for (x = (x<<3)+x; len>0; len--, ch++, x++) { if (*ch == 32) { x+=5; continue; } ac = *ch-'!'+STARTALPHANUM; if (ac < STARTALPHANUM || ac > ENDALPHANUM) return; rotatesprite(x<<16, (y<<3)<<16, 65536l, 0, ac, shade, pal, 8|16, 0, 0, xdim-1, ydim-1); if (*ch >= '0' && *ch <= '9') x+=8; else x += tilesizx[ac]; } }
void playanm(short anim_num) { unsigned char *animbuf, *palptr; int i, j, k, length = 0, numframes = 0; int32 handle = -1; unsigned char ANIMvesapal[4*256]; unsigned char tempbuf[256]; unsigned char *palook_bak = palookup[0]; UserInput uinfo = { FALSE, FALSE, dir_None }; ANIMnum = anim_num; KB_FlushKeyboardQueue(); KB_ClearKeysDown(); DSPRINTF(ds,"PlayAnm"); MONO_PRINT(ds); DSPRINTF(ds,"PlayAnm"); MONO_PRINT(ds); animbuf = LoadAnm(anim_num); if (!animbuf) return; DSPRINTF(ds,"PlayAnm - Palette Stuff"); MONO_PRINT(ds); for (i = 0; i < 256; i++) tempbuf[i] = i; palookup[0] = tempbuf; ANIM_LoadAnim(animbuf); ANIMnumframes = ANIM_NumFrames(); numframes = ANIMnumframes; palptr = ANIM_GetPalette(); for (i = 0; i < 768; i++) ANIMvesapal[i] = palptr[i]>>2; tilesizx[ANIM_TILE(ANIMnum)] = 200; tilesizy[ANIM_TILE(ANIMnum)] = 320; clearview(0); setbrightness(gs.Brightness,ANIMvesapal,2); if (ANIMnum == 1) { // draw the first frame waloff[ANIM_TILE(ANIMnum)] = (intptr_t)ANIM_DrawFrame(1); invalidatetile(ANIM_TILE(ANIMnum), 0, 1<<4); rotatesprite(0 << 16, 0 << 16, 65536L, 512, ANIM_TILE(ANIMnum), 0, 0, 2 + 4 + 8 + 16 + 64, 0, 0, xdim - 1, ydim - 1); } SoundState = 0; //ototalclock = totalclock + 120*2; ototalclock = totalclock; for (i = 1; i < numframes; i++) { while (totalclock < ototalclock) { handleevents(); CONTROL_GetUserInput(&uinfo); CONTROL_ClearUserInput(&uinfo); switch (ANIMnum) { case ANIM_INTRO: if (KB_KeyWaiting() || uinfo.button0 || uinfo.button1 || quitevent) goto ENDOFANIMLOOP; break; case ANIM_SERP: if (KEY_PRESSED(KEYSC_ESC) || uinfo.button1 || quitevent) goto ENDOFANIMLOOP; break; } getpackets(); } switch (ANIMnum) { case ANIM_INTRO: AnimShareIntro(i,numframes); break; case ANIM_SERP: AnimSerp(i,numframes); break; case ANIM_SUMO: AnimSumo(i,numframes); break; case ANIM_ZILLA: AnimZilla(i,numframes); break; } waloff[ANIM_TILE(ANIMnum)] = (intptr_t)ANIM_DrawFrame(i); invalidatetile(ANIM_TILE(ANIMnum), 0, 1<<4); rotatesprite(0 << 16, 0 << 16, 65536L, 512, ANIM_TILE(ANIMnum), 0, 0, 2 + 4 + 8 + 16 + 64, 0, 0, xdim - 1, ydim - 1); nextpage(); } // pause on final frame while (totalclock < ototalclock) { handleevents(); getpackets(); } ENDOFANIMLOOP: clearview(0); nextpage(); palookup[0] = palook_bak; setbrightness(gs.Brightness, (unsigned char*)palette_data, 2); KB_FlushKeyboardQueue(); KB_ClearKeysDown(); ANIM_FreeAnim(); walock[ANIM_TILE(ANIMnum)] = 1; }
void playanm ( short anim_num ) { char *animbuf, *palptr; long i, j, k, numframes = 0; int32 handle = -1; char ANIMvesapal[4 * 256]; char tempbuf[256]; char *palook_bak = palookup[0]; ANIMnum = anim_num; KB_FlushKeyboardQueue(); KB_ClearKeysDown(); DSPRINTF ( ds, "PlayAnm" ); MONO_PRINT ( ds ); DSPRINTF ( ds, "PlayAnm" ); MONO_PRINT ( ds ); animbuf = LoadAnm ( anim_num ); if ( !animbuf ) { return; } DSPRINTF ( ds, "PlayAnm - Palette Stuff" ); MONO_PRINT ( ds ); for ( i = 0; i < 256; i++ ) { tempbuf[i] = i; } palookup[0] = tempbuf; ANIM_LoadAnim ( ( uint8_t * ) animbuf, length ); ANIMnumframes = ANIM_NumFrames(); numframes = ANIMnumframes; palptr = ( char * ) ANIM_GetPalette(); for ( i = 0; i < 768; i++ ) { ANIMvesapal[i] = palptr[i] >> 2; } tilesiz[TILE_ANIM].x = 200; tilesiz[TILE_ANIM].y = 320; setbasepal ( 0, ( const uint8_t * ) ANIMvesapal ); setbrightness ( gs.Brightness, 0, 2 ); if ( ANIMnum == 1 ) { // draw the first frame waloff[TILE_ANIM] = FP_OFF ( ANIM_DrawFrame ( 1 ) ); invalidatetile ( TILE_ANIM, 0, 1 << 4 ); rotatesprite ( 0 << 16, 0 << 16, 65536L, 512, TILE_ANIM, 0, 0, 2 + 4 + 8 + 16 + 64, 0, 0, xdim - 1, ydim - 1 ); } SoundState = 0; //ototalclock = totalclock + 120*2; ototalclock = totalclock; for ( i = 1; i < numframes; i++ ) { while ( totalclock < ototalclock ) { switch ( ANIMnum ) { case 0: if ( KB_KeyWaiting() ) { goto ENDOFANIMLOOP; } break; case 1: if ( KEY_PRESSED ( KEYSC_ESC ) ) { goto ENDOFANIMLOOP; } break; } getpackets(); } switch ( ANIMnum ) { case ANIM_INTRO: AnimShareIntro ( i, numframes ); break; case ANIM_SERP: AnimSerp ( i, numframes ); break; case ANIM_SUMO: AnimSumo ( i, numframes ); break; case ANIM_ZILLA: AnimZilla ( i, numframes ); break; } waloff[TILE_ANIM] = FP_OFF ( ANIM_DrawFrame ( i ) ); invalidatetile ( TILE_ANIM, 0, 1 << 4 ); rotatesprite ( 0 << 16, 0 << 16, 65536L, 512, TILE_ANIM, 0, 0, 2 + 4 + 8 + 16 + 64, 0, 0, xdim - 1, ydim - 1 ); nextpage(); } // pause on final frame while ( totalclock < ototalclock ) { getpackets(); } ENDOFANIMLOOP: clearview ( 0 ); nextpage(); palookup[0] = palook_bak; // setbrightness(gs.Brightness, (char*)palette_data, 2); setbasepal ( 0, ( const uint8_t * ) palette_data ); setbrightness ( gs.Brightness, 0, 2 ); KB_FlushKeyboardQueue(); KB_ClearKeysDown(); ANIM_FreeAnim(); walock[ANIM_TILE ( ANIMnum )] = 1; }
void CONSOLE_Render() { if(g_CV_classic) { return; } // Let the Cvars draw something if they need to. CVAR_Render(); if(nConsole_Active) { int x,y, y1, y2; int i, iCurHeight = 0, iCurWidth = 0; int iYOffset = 3; //offset for the console text CONSOLEELEMENT *pElement; y1 = 0; y2 = (ydim / 2) - ((ydim / 2)/12); // Draw console background for(y=y1;y<y2;y+=128) { for(x=0;x<xdim;x+=128) { rotatesprite(x<<16,y<<16,65536L,0,BIGHOLE,8,0,(g_CV_TransConsole ? 1:0)+8+16+64+128,0,y1,xdim-1,y2-1); } } // Draw bottom egde of console rotatesprite(78<<16,94<<16,65536L,512,WINDOWBORDER1,24,0,2+8,0,0,xdim-1,ydim-1); rotatesprite(238<<16,94<<16,65536L,512,WINDOWBORDER1,24,0,2+8,0,0,xdim-1,ydim-1); // Draw the contents of the console buffer pElement = p_console_current_view;//console_buffer; for(i = 0; i < MAX_CONSOLE_VIEWABLE; i++) { if(!pElement) { break; } minitext(5,(8*(9-i)) + iYOffset, pElement->text, g_CV_console_text_color, 10+16); pElement = (CONSOLEELEMENT*)pElement->next; } // Set the height of the new line iCurHeight = (8*10) + iYOffset; // Draw dirty buffer minitext(5, iCurHeight, dirty_buffer, 0,10+16); // Calculate the location of the cursor iCurWidth = (console_cursor_pos*4) + (console_num_spaces*5) +5; //Draw the version number minitext(283, iCurHeight, BUILD_NUMBER, 17,10+16); // Draw the cursor //Change the color every second minitext(iCurWidth, iCurHeight,"_",(time(NULL)%2)+1,10+16); } else if(g_CV_num_console_lines > 0) { int i, iYOffset = 3; //offset for the console text CONSOLEELEMENT *pElement; // Draw the contents of the console buffer pElement = console_buffer; for(i = 0; i < g_CV_num_console_lines; i++) { if(!pElement) { break; } minitext(5,(8*((g_CV_num_console_lines-1)-i)) + iYOffset, pElement->text, g_CV_console_text_color, 10+16); pElement = (CONSOLEELEMENT*)pElement->next; } } }