From 4ee1216bab115a748f9313c15a1b25fe5cae0c5e Mon Sep 17 00:00:00 2001 From: ketmar Date: Tue, 25 Dec 2018 18:44:06 +0000 Subject: [PATCH] fixes for API renaming FossilOrigin-Name: 1164bcdce2f592a798e58275b55dc9dd15a601769cdb0e30b08bf90a956f0dcf --- GameLevel.vc | 196 ++++++++++++++++++------------------ PlayerPawn.vc | 6 +- mapent/MapObject.vc | 22 ++--- mapent/MapTile.vc | 6 +- mapent/characters/damsel.vc | 6 +- mapent/characters/tunnelman.vc | 6 +- mapent/enemies/jaws.vc | 22 ++--- mapent/enemies/monkey.vc | 6 +- mapent/tiles/arrowtraps.vc | 8 +- mapent/tiles/speartraps.vc | 8 +- mapent/tiles/titletiles.vc | 18 ++-- packages/Sprites/0classes.vc | 2 +- packages/Sprites/BackTileStore.vc | 2 +- packages/Sprites/SpriteStore.vc | 32 +++--- pxcdtest.vc | 52 +++++----- pxcdtest1.vc | 66 ++++++------- roomEnd.vc | 32 +++--- roomIntro.vc | 12 +-- spelunky_main.vc | 202 +++++++++++++++++++------------------- uisimple.vc | 10 +- 20 files changed, 357 insertions(+), 357 deletions(-) diff --git a/GameLevel.vc b/GameLevel.vc index 67d85ad..f424e81 100644 --- a/GameLevel.vc +++ b/GameLevel.vc @@ -3389,7 +3389,7 @@ void renderTransitionInfo (float currFrameDelta) { maxLen *= 8; sprStore.loadFont('sFontSmall'); - Video.color = 0xff_ff_00; + GLVideo.color = 0xff_ff_00; foreach (int idx, ref auto k; stats.kills) { int deaths = 0; foreach (int xidx, ref auto d; stats.totalKills) { @@ -3412,12 +3412,12 @@ void renderGhostTimer (float currFrameDelta) { int rhgt = round(float(hgt)*(float(ghostTimeLeft)/30.0)/1000.0); //writeln("hgt=", hgt, "; rhgt=", rhgt, "; gtl=", ghostTimeLeft/30); if (rhgt > 0) { - auto oclr = Video.color; - Video.color = 0xcf_ff_7f_00; - Video.fillRect(viewWidth-20, 32, 16, hgt-rhgt); - Video.color = 0x7f_ff_7f_00; - Video.fillRect(viewWidth-20, 32+(hgt-rhgt), 16, rhgt); - Video.color = oclr; + auto oclr = GLVideo.color; + GLVideo.color = 0xcf_ff_7f_00; + GLVideo.fillRect(viewWidth-20, 32, 16, hgt-rhgt); + GLVideo.color = 0x7f_ff_7f_00; + GLVideo.fillRect(viewWidth-20, 32+(hgt-rhgt), 16, rhgt); + GLVideo.color = oclr; } } @@ -3440,7 +3440,7 @@ void renderStarsHUD (float currFrameDelta) { hhup = 2; } - Video.color = 0xff_ff_ff|talpha; //draw_set_color(c_white); + GLVideo.color = 0xff_ff_ff|talpha; //draw_set_color(c_white); //draw_sprite(sHeart, -1, view_xview[0]+8, view_yview[0]+8); //draw_text(view_xview[0]+24, view_yview[0]+8, life); if (scumSmallHud) { @@ -3471,7 +3471,7 @@ void renderStarsHUD (float currFrameDelta) { if (starsRoomTimer1 > 0) { sprStore.loadFont('sFontSmall'); - Video.color = 0xff_ff_00; + GLVideo.color = 0xff_ff_00; int scale = global.scale; sprStore.renderMultilineTextCentered(viewWidth/2, 216*scale, va("SHOTGUN CHALLENGE BEGINS IN ~%d~", (starsRoomTimer1/30)+1), scale, 0xff_00_00); } @@ -3496,7 +3496,7 @@ void renderSunHUD (float currFrameDelta) { hhup = 2; } - Video.color = 0xff_ff_ff|talpha; //draw_set_color(c_white); + GLVideo.color = 0xff_ff_ff|talpha; //draw_set_color(c_white); //draw_sprite(sHeart, -1, view_xview[0]+8, view_yview[0]+8); //draw_text(view_xview[0]+24, view_yview[0]+8, life); if (scumSmallHud) { @@ -3527,7 +3527,7 @@ void renderSunHUD (float currFrameDelta) { if (sunRoomTimer1 > 0) { sprStore.loadFont('sFontSmall'); - Video.color = 0xff_ff_00; + GLVideo.color = 0xff_ff_00; int scale = global.scale; sprStore.renderMultilineTextCentered(viewWidth/2, 216*scale, va("DAMSEL CHALLENGE BEGINS IN ~%d~", (sunRoomTimer1/30)+1), scale, 0xff_00_00); } @@ -3552,7 +3552,7 @@ void renderMoonHUD (float currFrameDelta) { hhup = 2; } - Video.color = 0xff_ff_ff|talpha; //draw_set_color(c_white); + GLVideo.color = 0xff_ff_ff|talpha; //draw_set_color(c_white); //draw_sprite(sShopkeeperIcon, -1, view_xview[0]+64, view_yview[0]+8); drawSpriteAt('sHoopsIcon', -1, 8, hhup, scumSmallHud); @@ -3562,7 +3562,7 @@ void renderMoonHUD (float currFrameDelta) { if (moonRoomTimer1 > 0) { sprStore.loadFont('sFontSmall'); - Video.color = 0xff_ff_00; + GLVideo.color = 0xff_ff_00; int scale = global.scale; sprStore.renderMultilineTextCentered(viewWidth/2, 216*scale, va("ARCHERY CHALLENGE BEGINS IN ~%d~", (moonRoomTimer1/30)+1), scale, 0xff_00_00); } @@ -3598,8 +3598,8 @@ void renderHUD (float currFrameDelta) { int talpha = clamp(global.config.hudTextAlpha, 0, 255)<<24; int ialpha = clamp(global.config.hudItemsAlpha, 0, 255)<<24; - //Video.color = 0xff_ff_ff; - Video.color = 0xff_ff_ff|talpha; + //GLVideo.color = 0xff_ff_ff; + GLVideo.color = 0xff_ff_ff|talpha; // hearts if (scumSmallHud) { @@ -3660,7 +3660,7 @@ void renderHUD (float currFrameDelta) { drawTextAt(moneyX+16, 8-hhup, va("%d", stats.money-xmoney)); // items - Video.color = 0xff_ff_ff|ialpha; + GLVideo.color = 0xff_ff_ff|ialpha; int ity = (scumSmallHud ? 18-hhup : 24-hhup); @@ -3695,7 +3695,7 @@ void renderHUD (float currFrameDelta) { int m = 1; float malpha = 1; while (m <= global.arrows && m <= 20 && malpha > 0) { - Video.color = trunc(malpha*255)<<24|0xff_ff_ff; + GLVideo.color = trunc(malpha*255)<<24|0xff_ff_ff; drawSpriteAt('sArrowIcon', -1, n, ity); n += 4; if (m > 10) malpha -= 0.1; //and global.arrows > 20 malpha -= 0.1 @@ -3705,12 +3705,12 @@ void renderHUD (float currFrameDelta) { if (xmoney > 0) { sprStore.loadFont('sFontSmall'); - Video.color = 0xff_ff_00|talpha; + GLVideo.color = 0xff_ff_00|talpha; if (scumSmallHud) drawTextAt(moneyX+8, 8+8-hhup, va("+%d", xmoney)); else drawTextAt(moneyX, 8+16-hhup, va("+%d", xmoney)); } - Video.color = 0xff_ff_ff; + GLVideo.color = 0xff_ff_ff; if (global.config.ghostShowTime) renderGhostTimer(currFrameDelta); } @@ -3733,33 +3733,33 @@ final void drawTextAtS3Centered (int y0, string text, optional int hiColor1, opt void renderHelpOverlay () { - Video.color = 0; - Video.fillRect(0, 0, viewWidth, viewHeight); + GLVideo.color = 0; + GLVideo.fillRect(0, 0, viewWidth, viewHeight); int tx = 16; int txoff = 0; // text x pos offset (for multi-color lines) int ty = 8; if (gameHelpScreen) { sprStore.loadFont('sFontSmall'); - Video.color = 0xff_ff_ff; + GLVideo.color = 0xff_ff_ff; drawTextAtS3Centered(ty, va("HELP (PAGE ~%d~ OF ~%d~)", gameHelpScreen, MaxGameHelpScreen), 0xff_ff_00); ty += 24; } if (gameHelpScreen == 1) { sprStore.loadFont('sFontSmall'); - Video.color = 0xff_ff_00; drawTextAtS3(tx, ty, "INVENTORY BASICS"); ty += 16; - Video.color = 0xff_ff_ff; + GLVideo.color = 0xff_ff_00; drawTextAtS3(tx, ty, "INVENTORY BASICS"); ty += 16; + GLVideo.color = 0xff_ff_ff; drawTextAtS3(tx, ty, global.expandString("Press $SWITCH to cycle through items."), 0x00_ff_00); ty += 8; ty += 56; - Video.color = 0xff_ff_ff; + GLVideo.color = 0xff_ff_ff; drawSpriteAtS3('sHelpSprite1', -1, 64, 96); } else if (gameHelpScreen == 2) { sprStore.loadFont('sFontSmall'); - Video.color = 0xff_ff_00; + GLVideo.color = 0xff_ff_00; drawTextAtS3(tx, ty, "SELLING TO SHOPKEEPERS"); ty += 16; - Video.color = 0xff_ff_ff; + GLVideo.color = 0xff_ff_ff; drawTextAtS3(tx, ty, global.expandString("Press $PAY to offer your currently"), 0x00_ff_00); ty += 8; drawTextAtS3(tx, ty, "held item to the shopkeeper."); ty += 16; drawTextAtS3(tx, ty, "If the shopkeeper is interested, "); ty += 8; @@ -3774,11 +3774,11 @@ void renderHelpOverlay () { } else { // map sprStore.loadFont('sFont'); - Video.color = 0xff_ff_ff; + GLVideo.color = 0xff_ff_ff; drawTextAtS3(136, 8, "MAP"); if (lg.mapSprite && (isNormalLevel() || isTransitionRoom())) { - Video.color = 0xff_ff_00; + GLVideo.color = 0xff_ff_00; drawTextAtS3Centered(24, lg.mapTitle); auto spf = sprStore[lg.mapSprite].frames[0]; @@ -3786,7 +3786,7 @@ void renderHelpOverlay () { int mapY = 120-spf.height/2; //mapTitleX = 160-string_length(global.mapTitle)*8/2; - Video.color = 0xff_ff_ff; + GLVideo.color = 0xff_ff_ff; drawSpriteAtS3(lg.mapSprite, -1, mapX, mapY); if (lg.mapSprite != 'sMapDefault') { @@ -3831,10 +3831,10 @@ void renderHelpOverlay () { } sprStore.loadFont('sFontSmall'); - Video.color = 0xff_ff_00; + GLVideo.color = 0xff_ff_00; drawTextAtS3Centered(232, "PRESS ~SPACE~/~LEFT~/~RIGHT~ TO CHANGE PAGE", 0x00_ff_00); - Video.color = 0xff_ff_ff; + GLVideo.color = 0xff_ff_ff; } @@ -3843,7 +3843,7 @@ void renderPauseOverlay () { if (gameShowHelp) { renderHelpOverlay(); return; } - Video.color = 0xff_ff_00; + GLVideo.color = 0xff_ff_00; //int hiColor = 0x00_ff_00; int n = 120; @@ -3870,7 +3870,7 @@ void renderPauseOverlay () { } sprStore.loadFont('sFontSmall'); - Video.color = 0xff_ff_ff; + GLVideo.color = 0xff_ff_ff; drawTextAtS3Centered(240-2-8, "~ESC~-RETURN ~F10~-QUIT ~CTRL+DEL~-SUICIDE", 0xff_7f_00); drawTextAtS3Centered(2, "~O~PTIONS REDEFINE ~K~EYS ~S~TATISTICS", 0xff_7f_00); } @@ -3914,7 +3914,7 @@ void thinkFrameTransition () { void renderTransitionOverlay () { sprStore.loadFont('sFontSmall'); - Video.color = 0xff_ff_00; + GLVideo.color = 0xff_ff_00; //else if (global.currLevel-1 < 1) draw_text(32, 48, "TUTORIAL CAVE COMPLETED!"); //else draw_text(32, 48, "LEVEL "+string(global.currLevel-1)+" COMPLETED!"); if (global.currLevel == 0) { @@ -3922,7 +3922,7 @@ void renderTransitionOverlay () { } else { drawTextAt(32, 48, va("LEVEL ~%d~ COMPLETED!", global.currLevel), hiColor1:0x00_ff_ff); } - Video.color = 0xff_ff_ff; + GLVideo.color = 0xff_ff_ff; drawTextAt(32, 64, va("TIME = ~%s~", time2str((levelEndTime-levelStartTime)/30)), hiColor1:0xff_ff_00); if (/*stats.collected.length == 0*/stats.money <= levelMoneyStart) { @@ -3966,21 +3966,21 @@ void renderWithOfs (int xofs, int yofs, float currFrameDelta) { int scale = global.scale; // don't touch framebuffer alpha - Video.colorMask = Video::CMask.Colors; - Video.color = 0xff_ff_ff; + GLVideo.colorMask = GLVideo::CMask.Colors; + GLVideo.color = 0xff_ff_ff; /* - Video::ScissorRect scsave; + GLVideo::ScissorRect scsave; bool doRestoreGL = false; if (viewOffsetX > 0 || viewOffsetY > 0) { doRestoreGL = true; - Video.getScissor(scsave); - Video.scissorCombine(viewOffsetX, viewOffsetY, viewWidth, viewHeight); - Video.glPushMatrix(); - Video.glTranslate(viewOffsetX, viewOffsetY); - //Video.glTranslate(-550, 0); - //Video.glScale(1, 1); + GLVideo.getScissor(scsave); + GLVideo.scissorCombine(viewOffsetX, viewOffsetY, viewWidth, viewHeight); + GLVideo.glPushMatrix(); + GLVideo.glTranslate(viewOffsetX, viewOffsetY); + //GLVideo.glTranslate(-550, 0); + //GLVideo.glScale(1, 1); } */ @@ -4134,32 +4134,32 @@ void renderWithOfs (int xofs, int yofs, float currFrameDelta) { auto ltex = bgtileStore.lightTexture('ltx512', 512); // set screen alpha to min - Video.colorMask = Video::CMask.Alpha; - Video.blendMode = Video::BlendMode.None; - Video.color = 0xff_ff_ff_ff; - Video.fillRect(0, 0, Video.screenWidth, Video.screenHeight); - //Video.colorMask = Video::CMask.All; + GLVideo.colorMask = GLVideo::CMask.Alpha; + GLVideo.blendMode = GLVideo::BlendMode.None; + GLVideo.color = 0xff_ff_ff_ff; + GLVideo.fillRect(0, 0, GLVideo.screenWidth, GLVideo.screenHeight); + //GLVideo.colorMask = GLVideo::CMask.All; // blend lights // also, stencil 'em, so we can filter dark areas - Video.textureFiltering = true; - Video.stencil = true; - Video.stencilFunc(Video::StencilFunc.Always, 1); - Video.stencilOp(Video::StencilOp.Keep, Video::StencilOp.Replace); - Video.alphaTestFunc = Video::AlphaFunc.Greater; - Video.alphaTestVal = 0.03+0.011*global.config.darknessDarkness; - Video.color = 0xff_ff_ff; - Video.blendFunc = Video::BlendFunc.Max; - Video.blendMode = Video::BlendMode.Blend; // anything except `Normal` - Video.colorMask = Video::CMask.Alpha; + GLVideo.textureFiltering = true; + GLVideo.stencil = true; + GLVideo.stencilFunc(GLVideo::StencilFunc.Always, 1); + GLVideo.stencilOp(GLVideo::StencilOp.Keep, GLVideo::StencilOp.Replace); + GLVideo.alphaTestFunc = GLVideo::AlphaFunc.Greater; + GLVideo.alphaTestVal = 0.03+0.011*global.config.darknessDarkness; + GLVideo.color = 0xff_ff_ff; + GLVideo.blendFunc = GLVideo::BlendFunc.Max; + GLVideo.blendMode = GLVideo::BlendMode.Blend; // anything except `Normal` + GLVideo.colorMask = GLVideo::CMask.Alpha; foreach (MapEntity e; renderVisibleLights) { int xi, yi; e.getInterpCoords(currFrameDelta, scale, out xi, out yi); auto tile = MapTile(e); if (tile && tile.litWholeTile) { - //Video.color = 0xff_ff_ff; - Video.fillRect(xi-xofs, yi-yofs, e.width*scale, e.height*scale); + //GLVideo.color = 0xff_ff_ff; + GLVideo.fillRect(xi-xofs, yi-yofs, e.width*scale, e.height*scale); } int lrad = e.lightRadius; if (lrad < 4) continue; // just in case @@ -4186,37 +4186,37 @@ void renderWithOfs (int xofs, int yofs, float currFrameDelta) { yi -= yofs+lrad; ltex.tex.blitAt(xi, yi, lightscale); } - Video.textureFiltering = false; + GLVideo.textureFiltering = false; if (!loserGPU) { // modify only lit parts - Video.stencilFunc(Video::StencilFunc.Equal, 1); - Video.stencilOp(Video::StencilOp.Keep, Video::StencilOp.Keep); + GLVideo.stencilFunc(GLVideo::StencilFunc.Equal, 1); + GLVideo.stencilOp(GLVideo::StencilOp.Keep, GLVideo::StencilOp.Keep); // multiply framebuffer colors by framebuffer alpha - Video.color = 0xff_ff_ff; // it doesn't matter - Video.blendFunc = Video::BlendFunc.Add; - Video.blendMode = Video::BlendMode.DstMulDstAlpha; - Video.colorMask = Video::CMask.Colors; - Video.fillRect(0, 0, Video.screenWidth, Video.screenHeight); + GLVideo.color = 0xff_ff_ff; // it doesn't matter + GLVideo.blendFunc = GLVideo::BlendFunc.Add; + GLVideo.blendMode = GLVideo::BlendMode.DstMulDstAlpha; + GLVideo.colorMask = GLVideo::CMask.Colors; + GLVideo.fillRect(0, 0, GLVideo.screenWidth, GLVideo.screenHeight); } // filter unlit parts - Video.stencilFunc(Video::StencilFunc.NotEqual, 1); - Video.stencilOp(Video::StencilOp.Keep, Video::StencilOp.Keep); - Video.blendFunc = Video::BlendFunc.Add; - Video.blendMode = Video::BlendMode.Filter; - Video.colorMask = Video::CMask.Colors; - Video.color = 0x00_00_18+0x00_00_10*global.config.darknessDarkness; - //Video.color = 0x00_00_18; - //Video.color = 0x00_00_38; - Video.fillRect(0, 0, Video.screenWidth, Video.screenHeight); + GLVideo.stencilFunc(GLVideo::StencilFunc.NotEqual, 1); + GLVideo.stencilOp(GLVideo::StencilOp.Keep, GLVideo::StencilOp.Keep); + GLVideo.blendFunc = GLVideo::BlendFunc.Add; + GLVideo.blendMode = GLVideo::BlendMode.Filter; + GLVideo.colorMask = GLVideo::CMask.Colors; + GLVideo.color = 0x00_00_18+0x00_00_10*global.config.darknessDarkness; + //GLVideo.color = 0x00_00_18; + //GLVideo.color = 0x00_00_38; + GLVideo.fillRect(0, 0, GLVideo.screenWidth, GLVideo.screenHeight); // restore defaults - Video.blendFunc = Video::BlendFunc.Add; - Video.blendMode = Video::BlendMode.Normal; - Video.colorMask = Video::CMask.All; - Video.alphaTestFunc = Video::AlphaFunc.Always; - Video.stencil = false; + GLVideo.blendFunc = GLVideo::BlendFunc.Add; + GLVideo.blendMode = GLVideo::BlendMode.Normal; + GLVideo.colorMask = GLVideo::CMask.All; + GLVideo.alphaTestFunc = GLVideo::AlphaFunc.Always; + GLVideo.stencil = false; } // clear visible objects list (nope) @@ -4236,18 +4236,18 @@ void renderWithOfs (int xofs, int yofs, float currFrameDelta) { auto msgHeight = sprStore.getMultilineTextHeight(msg, msgScale); int x = viewWidth/2; int y = viewHeight-64-msgHeight; - auto oldColor = Video.color; - Video.color = 0xff_ff_00; + auto oldColor = GLVideo.color; + GLVideo.color = 0xff_ff_00; if (osdTimeLeft < 0.5) { int alpha = 255-clamp(int(510*osdTimeLeft), 0, 255); - Video.color = Video.color|(alpha<<24); + GLVideo.color = GLVideo.color|(alpha<<24); } else if (ct-osdTimeStart < 0.5) { osdTimeStart = ct-osdTimeStart; int alpha = 255-clamp(int(510*osdTimeStart), 0, 255); - Video.color = Video.color|(alpha<<24); + GLVideo.color = GLVideo.color|(alpha<<24); } sprStore.renderMultilineTextCentered(x, y, msg, msgScale, 0x00_ff_00, 0xff_ff_ff); - Video.color = oldColor; + GLVideo.color = oldColor; } int hiColor1, hiColor2; @@ -4265,11 +4265,11 @@ void renderWithOfs (int xofs, int yofs, float currFrameDelta) { msgHeight *= msgScale; int x = (viewWidth-msgWidth)/2; int y = 32*msgScale; - auto oldColor = Video.color; + auto oldColor = GLVideo.color; // draw text frame and text background - Video.color = 0; - Video.fillRect(x, y, msgWidth, msgHeight); - Video.color = 0xff_ff_ff; + GLVideo.color = 0; + GLVideo.fillRect(x, y, msgWidth, msgHeight); + GLVideo.color = 0xff_ff_ff; for (int fdx = 0; fdx < msgWidth; fdx += 16*msgScale) { auto spf = sprStore['sMenuTop'].frames[0]; spf.blitAt(x+fdx, y-16*msgScale, msgScale); @@ -4292,9 +4292,9 @@ void renderWithOfs (int xofs, int yofs, float currFrameDelta) { spf = sprStore['sMenuLR'].frames[0]; spf.blitAt(x+msgWidth, y+msgHeight, msgScale); } - Video.color = 0xff_ff_00; + GLVideo.color = 0xff_ff_00; sprStore.renderMultilineText(x+(msgWidth-msgWidthOrig)/2, y+(msgHeight-msgHeightOrig)/2-3*msgScale, msg, msgScale, (hiColor1 == -1 ? 0x00_ff_00 : hiColor1), (hiColor2 == -1 ? 0xff_ff_ff : hiColor2)); - Video.color = oldColor; + GLVideo.color = oldColor; } if (inWinCutscene) renderWinCutsceneOverlay(); @@ -4303,12 +4303,12 @@ void renderWithOfs (int xofs, int yofs, float currFrameDelta) { /* if (doRestoreGL) { - Video.setScissor(scsave); - Video.glPopMatrix(); + GLVideo.setScissor(scsave); + GLVideo.glPopMatrix(); } */ - Video.color = 0xff_ff_ff; + GLVideo.color = 0xff_ff_ff; } diff --git a/PlayerPawn.vc b/PlayerPawn.vc index fe8230f..22d8240 100644 --- a/PlayerPawn.vc +++ b/PlayerPawn.vc @@ -3771,10 +3771,10 @@ override void drawWithOfs (int xpos, int ypos, int scale, float currFrameDelta) if (pp.active) pp.preDrawWithOfs(xpos, ypos, scale, currFrameDelta); } - auto oldColor = Video.color; - if (redColor > 0) Video.color = clamp(200+redColor, 0, 255)<<16; + auto oldColor = GLVideo.color; + if (redColor > 0) GLVideo.color = clamp(200+redColor, 0, 255)<<16; ::drawWithOfs(xpos, ypos, scale, currFrameDelta); - Video.color = oldColor; + GLVideo.color = oldColor; if (renderJetpackBack) { int xi, yi; diff --git a/mapent/MapObject.vc b/mapent/MapObject.vc index f0dd39f..ae62788 100644 --- a/mapent/MapObject.vc +++ b/mapent/MapObject.vc @@ -809,8 +809,8 @@ override void drawWithOfs (int xpos, int ypos, int scale, float currFrameDelta) auto spf = getSpriteFrame(out doMirror, out fx0, out fy0, out fx1, out fy1); if (!spf) return; - auto oclr = Video.color; - Video.color = oclr|(trunc(fclamp(255.0-255*imageAlpha, 0.0, 255.0))<<24); + auto oclr = GLVideo.color; + GLVideo.color = oclr|(trunc(fclamp(255.0-255*imageAlpha, 0.0, 255.0))<<24); fx0 = xi+fx0*scale-xpos; fy0 = yi+fy0*scale-ypos; @@ -821,22 +821,22 @@ override void drawWithOfs (int xpos, int ypos, int scale, float currFrameDelta) } else { spf.tex.blitExt(fx0, fy0, fx1, fy1, spf.width, 0, 0, spf.height, angle:imageAngle); } - Video.color = oclr; + GLVideo.color = oclr; #ifndef STANDALONE_MAP_ENTITY if (false) { - oclr = Video.color; - Video.color = 0xff_ff_00; - Video.drawRect(x0*scale-xpos, y0*scale-ypos, width*scale, height*scale); - Video.color = 0x00_ff_00; - Video.drawRect(ix*scale-xpos, iy*scale-ypos, 2, 2); + oclr = GLVideo.color; + GLVideo.color = 0xff_ff_00; + GLVideo.drawRect(x0*scale-xpos, y0*scale-ypos, width*scale, height*scale); + GLVideo.color = 0x00_ff_00; + GLVideo.drawRect(ix*scale-xpos, iy*scale-ypos, 2, 2); if (isCollision()) { - Video.color = 0x3f_ff_00_00; - Video.fillRect(x0*scale-xpos, y0*scale-ypos, width*scale, height*scale); + GLVideo.color = 0x3f_ff_00_00; + GLVideo.fillRect(x0*scale-xpos, y0*scale-ypos, width*scale, height*scale); } - Video.color = oclr; + GLVideo.color = oclr; } #endif } diff --git a/mapent/MapTile.vc b/mapent/MapTile.vc index 9fa4379..4ccea72 100644 --- a/mapent/MapTile.vc +++ b/mapent/MapTile.vc @@ -721,8 +721,8 @@ override void drawWithOfs (int xpos, int ypos, int scale, float currFrameDelta) int drwx, drwy; getInterpCoordsForTile(currFrameDelta, scale, out drwx, out drwy); - //auto oclr = Video.color; - //if (moveable) Video.color = 0xff_7f_00; + //auto oclr = GLVideo.color; + //if (moveable) GLVideo.color = 0xff_7f_00; if (spf) { fx0 = drwx+fx0*scale-xpos; @@ -741,7 +741,7 @@ override void drawWithOfs (int xpos, int ypos, int scale, float currFrameDelta) fy1 = drwy-ypos; } - //Video.color = oclr; + //GLVideo.color = oclr; if (ore > 0 && !hideOre) { auto ospr = level.sprStore[ore == 1 ? 'sGold' : 'sGoldBig']; diff --git a/mapent/characters/damsel.vc b/mapent/characters/damsel.vc index 2a97516..3554991 100644 --- a/mapent/characters/damsel.vc +++ b/mapent/characters/damsel.vc @@ -59,12 +59,12 @@ override void thinkFrame () { override void drawWithOfs (int xpos, int ypos, int scale, float currFrameDelta) { ::drawWithOfs(xpos, ypos, scale, currFrameDelta); if (kissed) { - auto oclr = Video.color; - Video.color = 0xff_ff_00; + auto oclr = GLVideo.color; + GLVideo.color = 0xff_ff_00; level.sprStore.loadFont('sFontSmall'); //int scale = 3; level.sprStore.renderText((ix-32)*scale-xpos, (iy-18)*scale-ypos, "MY HERO!", 3); - Video.color = oclr; + GLVideo.color = oclr; } } diff --git a/mapent/characters/tunnelman.vc b/mapent/characters/tunnelman.vc index 74a53ac..14c0819 100644 --- a/mapent/characters/tunnelman.vc +++ b/mapent/characters/tunnelman.vc @@ -140,12 +140,12 @@ override void thinkFrame () { override void drawWithOfs (int xpos, int ypos, int scale, float currFrameDelta) { ::drawWithOfs(xpos, ypos, scale, currFrameDelta); if (kissed) { - auto oclr = Video.color; - Video.color = 0xff_ff_00; + auto oclr = GLVideo.color; + GLVideo.color = 0xff_ff_00; level.sprStore.loadFont('sFontSmall'); //int scale = 3; level.sprStore.renderText((ix-32)*scale-xpos, (iy-18)*scale-ypos, "MY HERO!", 3); - Video.color = oclr; + GLVideo.color = oclr; } } */ diff --git a/mapent/enemies/jaws.vc b/mapent/enemies/jaws.vc index 910fce1..8b52828 100644 --- a/mapent/enemies/jaws.vc +++ b/mapent/enemies/jaws.vc @@ -108,8 +108,8 @@ override void drawWithOfs (int xpos, int ypos, int scale, float currFrameDelta) auto spf = getSpriteFrame(out doMirror, out fx0, out fy0, out fx1, out fy1); if (!spf) return; - auto oclr = Video.color; - Video.color = oclr|(trunc(fclamp(255.0-255*imageAlpha, 0.0, 255.0))<<24); + auto oclr = GLVideo.color; + GLVideo.color = oclr|(trunc(fclamp(255.0-255*imageAlpha, 0.0, 255.0))<<24); fx0 = xi+fx0*scale-xpos; fy0 = yi+fy0*scale-ypos; @@ -145,21 +145,21 @@ override void drawWithOfs (int xpos, int ypos, int scale, float currFrameDelta) } } - Video.color = oclr; + GLVideo.color = oclr; if (false) { - oclr = Video.color; - Video.color = 0xff_ff_00; - Video.drawRect(x0*scale-xpos, y0*scale-ypos, width*scale, height*scale); - Video.color = 0x00_ff_00; - Video.drawRect(ix*scale-xpos, iy*scale-ypos, 2, 2); + oclr = GLVideo.color; + GLVideo.color = 0xff_ff_00; + GLVideo.drawRect(x0*scale-xpos, y0*scale-ypos, width*scale, height*scale); + GLVideo.color = 0x00_ff_00; + GLVideo.drawRect(ix*scale-xpos, iy*scale-ypos, 2, 2); if (isCollision()) { - Video.color = 0x3f_ff_00_00; - Video.fillRect(x0*scale-xpos, y0*scale-ypos, width*scale, height*scale); + GLVideo.color = 0x3f_ff_00_00; + GLVideo.fillRect(x0*scale-xpos, y0*scale-ypos, width*scale, height*scale); } - Video.color = oclr; + GLVideo.color = oclr; } } diff --git a/mapent/enemies/monkey.vc b/mapent/enemies/monkey.vc index 6320916..b50ec50 100644 --- a/mapent/enemies/monkey.vc +++ b/mapent/enemies/monkey.vc @@ -484,10 +484,10 @@ class EnemyGoldMonkey['oMonkeyGold'] : EnemyMonkey; override void drawWithOfs (int xpos, int ypos, int scale, float currFrameDelta) { //image_blend = make_color_rgb(255, 245, 104); - auto oclr = Video.color; - Video.color = 0xff_f5_68; + auto oclr = GLVideo.color; + GLVideo.color = 0xff_f5_68; ::drawWithOfs(xpos, ypos, scale, currFrameDelta); - Video.color = oclr; + GLVideo.color = oclr; } diff --git a/mapent/tiles/arrowtraps.vc b/mapent/tiles/arrowtraps.vc index c212852..131eeb1 100644 --- a/mapent/tiles/arrowtraps.vc +++ b/mapent/tiles/arrowtraps.vc @@ -75,10 +75,10 @@ override void setupTile () { override void drawWithOfs (int xpos, int ypos, int scale, float currFrameDelta) { ::drawWithOfs(xpos, ypos, scale, currFrameDelta); if (!fired) { - auto oclr = Video.color; - Video.color = 0x7f_00_ff_00; - Video.fillRect(checkerX*scale-xpos, checkerY*scale-ypos, checkerW*scale, checkerH*scale); - Video.color = oclr; + auto oclr = GLVideo.color; + GLVideo.color = 0x7f_00_ff_00; + GLVideo.fillRect(checkerX*scale-xpos, checkerY*scale-ypos, checkerW*scale, checkerH*scale); + GLVideo.color = oclr; } } */ diff --git a/mapent/tiles/speartraps.vc b/mapent/tiles/speartraps.vc index 8b05316..02df693 100644 --- a/mapent/tiles/speartraps.vc +++ b/mapent/tiles/speartraps.vc @@ -61,10 +61,10 @@ override void setupTile () { override void drawWithOfs (int xpos, int ypos, int scale, float currFrameDelta) { ::drawWithOfs(xpos, ypos, scale, currFrameDelta); if (!fired) { - auto oclr = Video.color; - Video.color = 0x7f_00_ff_00; - Video.fillRect(checkerX*scale-xpos, checkerY*scale-ypos, checkerW*scale, checkerH*scale); - Video.color = oclr; + auto oclr = GLVideo.color; + GLVideo.color = 0x7f_00_ff_00; + GLVideo.fillRect(checkerX*scale-xpos, checkerY*scale-ypos, checkerW*scale, checkerH*scale); + GLVideo.color = oclr; } } */ diff --git a/mapent/tiles/titletiles.vc b/mapent/tiles/titletiles.vc index 05d1f14..23b1c59 100644 --- a/mapent/tiles/titletiles.vc +++ b/mapent/tiles/titletiles.vc @@ -156,30 +156,30 @@ override void drawWithOfs (int xpos, int ypos, int scale, float currFrameDelta) } auto spf = getSpriteFrame(); - Video.color = tCol; + GLVideo.color = tCol; spf.blitAt(x, y, scale); */ - auto oclr = Video.color; - Video.color = 0x8f_81_5b; + auto oclr = GLVideo.color; + GLVideo.color = 0x8f_81_5b; level.sprStore.loadFont('sFontSmall'); level.sprStore.renderText((ix+110)*scale-xpos, (iy+26)*scale-ypos, "K8", scale); //writeln("(", ix, ",", iy, ") : (526, 106)"); string bdate = level.getBuildDateString(); if (bdate) { level.sprStore.loadFont('sFontTiny'); - Video.color = 0x8f_81_5b; + GLVideo.color = 0x8f_81_5b; level.sprStore.renderText((ix+110-32)*scale-xpos, (iy+26+8)*scale-ypos, bdate, scale); } if (level.loserGPU) { - Video.color = 0xff_00_00; + GLVideo.color = 0xff_00_00; level.sprStore.loadFont('sFontSmall'); level.sprStore.renderText((ix-32)*scale-xpos, (iy+32)*scale-ypos, "YOUR GPU SUX!", scale); level.sprStore.renderText((ix-32)*scale-xpos, (iy+32+8)*scale-ypos, "DARKNESS WILL LOOK UGLY!", scale); } - Video.color = oclr; + GLVideo.color = oclr; } @@ -374,10 +374,10 @@ override void drawWithOfs (int xpos, int ypos, int scale, float currFrameDelta) } auto spf = getSpriteFrame(); - auto oclr = Video.color; - Video.color = tCol; + auto oclr = GLVideo.color; + GLVideo.color = tCol; spf.blitAt(x, y, scale); - Video.color = oclr; + GLVideo.color = oclr; } diff --git a/packages/Sprites/0classes.vc b/packages/Sprites/0classes.vc index 06d4d97..ef59316 100644 --- a/packages/Sprites/0classes.vc +++ b/packages/Sprites/0classes.vc @@ -9,7 +9,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. **************************************************************************/ -import 'Video'; +import 'GLVideo'; #include "SpriteStore.vc" #include "BackTileStore.vc" diff --git a/packages/Sprites/BackTileStore.vc b/packages/Sprites/BackTileStore.vc index ae4e4d8..a4fc8ed 100644 --- a/packages/Sprites/BackTileStore.vc +++ b/packages/Sprites/BackTileStore.vc @@ -49,7 +49,7 @@ final void blitAt (int x, int y, int scale, optional float angle) { static final BackTileImage Load (string fname) { - bool allowNPot = Video.glHasNPOT; + bool allowNPot = GLVideo.glHasNPOT; //if (allowNPot) writeln("*** NPOT textures allowed"); //allowNPot = false; diff --git a/packages/Sprites/SpriteStore.vc b/packages/Sprites/SpriteStore.vc index 9d6cac7..64e4833 100644 --- a/packages/Sprites/SpriteStore.vc +++ b/packages/Sprites/SpriteStore.vc @@ -551,10 +551,10 @@ private final void loadSprite (name Name) { if (!Name) FatalError("cannot load namelss sprite"); if (allowNPot < 0) { - if (!Video.isInitialized) { + if (!GLVideo.isInitialized) { writeln("preloading sprite '", Name, "'"); } else { - allowNPot = (Video.glHasNPOT ? 1 : 0); + allowNPot = (GLVideo.glHasNPOT ? 1 : 0); if (allowNPot) writeln("*** NPOT textures allowed"); //allowNPot = 0; } @@ -673,23 +673,23 @@ final void renderTextHiChar (int x, int y, string str, optional int scale, optio if (scale < 1 || !fontImg) return; auto flen = fontImg.frames.length; if (flen < 1) return; - auto oclr = Video.color; + auto oclr = GLVideo.color; foreach (auto sidx; 0..str.length) { auto ch = str[sidx]; if (ch >= "a" && ch <= "z" && ch-32 >= flen) ch -= 32; ch -= 32; if (ch >= 0 && ch < flen) { if (specified_hotCharOfs && specified_hotCharColor) { - if (hotCharOfs == sidx) Video.color = hotCharColor; + if (hotCharOfs == sidx) GLVideo.color = hotCharColor; } fontImg.frames[ch].blitAt(x, y, scale); x += fontImg.frames[ch].width*scale; - Video.color = oclr; + GLVideo.color = oclr; } else { x += fontImg.frames[0].width*scale; } } - Video.color = oclr; + GLVideo.color = oclr; } @@ -698,18 +698,18 @@ final void renderTextWithHighlight (int x, int y, string str, optional int scale if (scale < 1 || !fontImg) return; auto flen = fontImg.frames.length; if (flen < 1) return; - auto oclr = Video.color; + auto oclr = GLVideo.color; int inHigh = 0; foreach (auto sidx; 0..str.length) { auto ch = str[sidx]; if (ch == '~' && (!inHigh || inHigh == 1)) { inHigh = !inHigh; - Video.color = (inHigh ? hiColor : oclr); + GLVideo.color = (inHigh ? hiColor : oclr); continue; } if (specified_hiColor1 && ch == '|' && (!inHigh || inHigh == 2)) { inHigh = 2-inHigh; - Video.color = (inHigh ? hiColor1 : oclr); + GLVideo.color = (inHigh ? hiColor1 : oclr); continue; } if (ch >= "a" && ch <= "z" && ch-32 >= flen) ch -= 32; @@ -721,7 +721,7 @@ final void renderTextWithHighlight (int x, int y, string str, optional int scale x += fontImg.frames[0].width*scale; } } - Video.color = oclr; + GLVideo.color = oclr; } @@ -810,8 +810,8 @@ final void renderMultilineTextCentered (int x, int y, string str, optional int s if (scale < 1 || !fontImg) return; auto flen = fontImg.frames.length; if (flen < 1) return; - highColor1 = (highColor1&0xff_ff_ff)|(Video.color&0xff_00_00_00); - highColor2 = (highColor2&0xff_ff_ff)|(Video.color&0xff_00_00_00); + highColor1 = (highColor1&0xff_ff_ff)|(GLVideo.color&0xff_00_00_00); + highColor2 = (highColor2&0xff_ff_ff)|(GLVideo.color&0xff_00_00_00); int pos = 0; int endpos = str.length; while (endpos > 0 && str[endpos] == '\n') --endpos; @@ -819,7 +819,7 @@ final void renderMultilineTextCentered (int x, int y, string str, optional int s int lc = 1; foreach (auto sidx; pos..endpos) if (str[sidx] == '\n') ++lc; if (y == int.min) { - y = (Video.screenHeight-lc*getFontHeight(scale!optional))/2; + y = (GLVideo.screenHeight-lc*getFontHeight(scale!optional))/2; } else { y = (-y-lc*getFontHeight(scale!optional))/2; } @@ -844,8 +844,8 @@ final void renderMultilineText (int x, int y, string str, optional int scale, op if (scale < 1 || !fontImg) return; auto flen = fontImg.frames.length; if (flen < 1) return; - highColor1 = (highColor1&0xff_ff_ff)|(Video.color&0xff_00_00_00); - highColor2 = (highColor2&0xff_ff_ff)|(Video.color&0xff_00_00_00); + highColor1 = (highColor1&0xff_ff_ff)|(GLVideo.color&0xff_00_00_00); + highColor2 = (highColor2&0xff_ff_ff)|(GLVideo.color&0xff_00_00_00); int pos = 0; int endpos = str.length; while (endpos > 0 && str[endpos] == '\n') --endpos; @@ -853,7 +853,7 @@ final void renderMultilineText (int x, int y, string str, optional int scale, op int lc = 1; foreach (auto sidx; pos..endpos) if (str[sidx] == '\n') ++lc; if (y == int.min) { - y = (Video.screenHeight-lc*getFontHeight(scale!optional))/2; + y = (GLVideo.screenHeight-lc*getFontHeight(scale!optional))/2; } else { y = (-y-lc*getFontHeight(scale!optional))/2; } diff --git a/pxcdtest.vc b/pxcdtest.vc index a99cbeb..1ad3bd3 100644 --- a/pxcdtest.vc +++ b/pxcdtest.vc @@ -9,7 +9,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. **************************************************************************/ -import 'Video'; +import 'GLVideo'; import 'Sprites'; @@ -72,27 +72,27 @@ void testEllipse () { foreach (int py; y0..y1+1) { foreach (int px; x0..x1+1) { if (isInEllipse(px, py, x0, y0, x1, y1)) { - Video.fillRect(px, py, 1, 1); + GLVideo.fillRect(px, py, 1, 1); } } } - Video.color = 0xff_7f_00; - Video.drawRect(x0-1, y0-1, x1-x0+3, y1-y0+3); + GLVideo.color = 0xff_7f_00; + GLVideo.drawRect(x0-1, y0-1, x1-x0+3, y1-y0+3); } void drawMask (SpriteFrame frm, int x0, int y0, int scale, int col) { if (!frm) return; /* - Video.color = 0x7f_ff_ff_00; + GLVideo.color = 0x7f_ff_ff_00; foreach (int y; 0..frm.height) { foreach (int x; 0..frm.width) { if (frm.getMaskPixel(x, y)) { - Video.color = 0x3f_ff_ff_00; + GLVideo.color = 0x3f_ff_ff_00; } else { - Video.color = 0xcf_ff_ff_00; + GLVideo.color = 0xcf_ff_ff_00; } - Video.fillRect(x0+x*scale, y0+y*scale, scale, scale); + GLVideo.fillRect(x0+x*scale, y0+y*scale, scale, scale); } } */ @@ -103,18 +103,18 @@ void drawMask (SpriteFrame frm, int x0, int y0, int scale, int col) { foreach (int dx; 0..32) { if (col == -666) { // missed collision: red - Video.color = (v < 0 ? 0x3f_ff_00_00 : 0xcf_ff_00_00); + GLVideo.color = (v < 0 ? 0x3f_ff_00_00 : 0xcf_ff_00_00); } else if (col == -999) { // superfluous collision: blue - Video.color = (v < 0 ? 0x3f_00_00_ff : 0xcf_00_00_ff); + GLVideo.color = (v < 0 ? 0x3f_00_00_ff : 0xcf_00_00_ff); } else if (col <= 0) { // no collision: yellow - Video.color = (v < 0 ? 0x3f_ff_ff_00 : 0xcf_ff_ff_00); + GLVideo.color = (v < 0 ? 0x3f_ff_ff_00 : 0xcf_ff_ff_00); } else if (col > 0) { // collision: green - Video.color = (v < 0 ? 0x3f_00_ff_00 : 0xcf_00_ff_00); + GLVideo.color = (v < 0 ? 0x3f_00_ff_00 : 0xcf_00_ff_00); } - Video.fillRect(x0+(ix*32+dx)*scale, y0+y*scale, scale, scale); + GLVideo.fillRect(x0+(ix*32+dx)*scale, y0+y*scale, scale, scale); v <<= 1; } } @@ -124,8 +124,8 @@ void drawMask (SpriteFrame frm, int x0, int y0, int scale, int col) { void sprTestRender () { - Video.color = 0xff_ff_ff; - Video.clearScreen(); + GLVideo.color = 0xff_ff_ff; + GLVideo.clearScreen(); //writeln(!!spr[0]); auto frm0 = spr[0].frames[frms[0]]; @@ -150,15 +150,15 @@ void sprTestRender () { drawMask(frm0, spr0x, spr0y, 2, (slowCol == collided ? (collided ? 1 : 0) : (slowCol ? -666 : -999))); drawMask(frm1, x1, y1, 2, -1); - Video.color = 0xff_ff_ff; + GLVideo.color = 0xff_ff_ff; testEllipse(); } // ////////////////////////////////////////////////////////////////////////// // final void onDraw () { - if (Video.frameTime == 0) { - Video.requestRefresh(); + if (GLVideo.frameTime == 0) { + GLVideo.requestRefresh(); } sprTestRender(); @@ -170,7 +170,7 @@ int escCount; final void onEvent (ref event_t evt) { - if (evt.type == ev_closequery) { Video.requestQuit(); return; } + if (evt.type == ev_closequery) { GLVideo.requestQuit(); return; } if (evt.type == ev_winfocus) { if (!evt.focused) escCount = 0; @@ -180,7 +180,7 @@ final void onEvent (ref event_t evt) { if (evt.type == ev_keyup && evt.keycode != K_ESCAPE) escCount = 0; if (evt.type == ev_keyup && evt.keycode == K_ESCAPE) { - if (++escCount == 2) Video.requestQuit(); + if (++escCount == 2) GLVideo.requestQuit(); return; } @@ -196,7 +196,7 @@ final void onEvent (ref event_t evt) { final void runIn () { - Video.frameTime = 0; // unlimited FPS + GLVideo.frameTime = 0; // unlimited FPS sprStore = SpawnObject(SpriteStore); sprStore.bDumpLoaded = false; @@ -206,11 +206,11 @@ final void runIn () { sprInit(); - Video.swapInterval = 1; - //Video.openScreen("Spelunky/VaVoom C", GameLevel::TilesWidth*16, GameLevel::TilesHeight*16); - Video.openScreen("Spelunky/VaVoom C", 320*3, 240*3); - Video.runEventLoop(); - Video.closeScreen(); + GLVideo.swapInterval = 1; + //GLVideo.openScreen("Spelunky/VaVoom C", GameLevel::TilesWidth*16, GameLevel::TilesHeight*16); + GLVideo.openScreen("Spelunky/VaVoom C", 320*3, 240*3); + GLVideo.runEventLoop(); + GLVideo.closeScreen(); } diff --git a/pxcdtest1.vc b/pxcdtest1.vc index 9071517..f5e863a 100644 --- a/pxcdtest1.vc +++ b/pxcdtest1.vc @@ -9,7 +9,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. **************************************************************************/ -import 'Video'; +import 'GLVideo'; import 'Sprites'; //import 'Game'; @@ -69,16 +69,16 @@ void sprInit () { final void setColorByIdx (bool isset, int col) { if (col == -666) { // missed collision: red - Video.color = (isset ? 0x3f_ff_00_00 : 0xcf_ff_00_00); + GLVideo.color = (isset ? 0x3f_ff_00_00 : 0xcf_ff_00_00); } else if (col == -999) { // superfluous collision: blue - Video.color = (isset ? 0x3f_00_00_ff : 0xcf_00_00_ff); + GLVideo.color = (isset ? 0x3f_00_00_ff : 0xcf_00_00_ff); } else if (col <= 0) { // no collision: yellow - Video.color = (isset ? 0x3f_ff_ff_00 : 0xcf_ff_ff_00); + GLVideo.color = (isset ? 0x3f_ff_ff_00 : 0xcf_ff_ff_00); } else if (col > 0) { // collision: green - Video.color = (isset ? 0x3f_00_ff_00 : 0xcf_00_ff_00); + GLVideo.color = (isset ? 0x3f_00_ff_00 : 0xcf_00_ff_00); } } @@ -95,8 +95,8 @@ final void drawMask (SpriteFrame frm, int sx, int sy, int scale, int x0, int y0, y0 = 0; int bx0, by0, bx1, by1; frm.getBBox(out bx0, out by0, out bx1, out by1, mirror); - Video.color = 0x7f_00_00_ff; - Video.fillRect(sx+bx0*scale, sy+by0*scale, (bx1-bx0+1)*scale, (by1-by0+1)*scale); + GLVideo.color = 0x7f_00_00_ff; + GLVideo.fillRect(sx+bx0*scale, sy+by0*scale, (bx1-bx0+1)*scale, (by1-by0+1)*scale); if (!cm.isEmptyMask) { //writeln(cm.mask.length, "; ", cm.width, "x", cm.height, "; (", cm.x0, ",", cm.y0, ")-(", cm.x1, ",", cm.y1, ")"); foreach (int iy; 0..cm.height) { @@ -106,11 +106,11 @@ final void drawMask (SpriteFrame frm, int sx, int sy, int scale, int x0, int y0, int xx = ix*32+dx; if (v < 0) { setColorByIdx(v < 0, col); - if (xx < x0 || xx > x1 || iy < y0 || iy > y1) Video.color = 0x3f_ff_00_00; + if (xx < x0 || xx > x1 || iy < y0 || iy > y1) GLVideo.color = 0x3f_ff_00_00; } else { - Video.color = (xx >= x0 && xx <= x1 && iy >= y0 && iy <= y1 ? 0xaf_00_ff_00 : 0xdf_00_ff_00); + GLVideo.color = (xx >= x0 && xx <= x1 && iy >= y0 && iy <= y1 ? 0xaf_00_ff_00 : 0xdf_00_ff_00); } - Video.fillRect(sx+xx*scale, sy+iy*scale, scale, scale); + GLVideo.fillRect(sx+xx*scale, sy+iy*scale, scale, scale); v <<= 1; } } @@ -124,20 +124,20 @@ final void drawMask (SpriteFrame frm, int sx, int sy, int scale, int x0, int y0, //if (xx >= frm.bx && xx < frm.bx+frm.bw && iy >= frm.by && iy < frm.by+frm.bh) { if (xx >= x0 && xx <= x1 && iy >= y0 && iy <= y1) { setColorByIdx(true, col); - if (col <= 0) Video.color = 0xaf_ff_ff_00; + if (col <= 0) GLVideo.color = 0xaf_ff_ff_00; } else { - Video.color = 0xaf_00_ff_00; + GLVideo.color = 0xaf_00_ff_00; } - Video.fillRect(sx+xx*scale, sy+iy*scale, scale, scale); + GLVideo.fillRect(sx+xx*scale, sy+iy*scale, scale, scale); } } } /* if (frm.bw > 0 && frm.bh > 0) { setColorByIdx(true, col); - Video.fillRect(x0+frm.bx*scale, y0+frm.by*scale, frm.bw*scale, frm.bh*scale); - Video.color = 0xff_00_00; - Video.drawRect(x0+frm.bx*scale, y0+frm.by*scale, frm.bw*scale, frm.bh*scale); + GLVideo.fillRect(x0+frm.bx*scale, y0+frm.by*scale, frm.bw*scale, frm.bh*scale); + GLVideo.color = 0xff_00_00; + GLVideo.drawRect(x0+frm.bx*scale, y0+frm.by*scale, frm.bw*scale, frm.bh*scale); } */ } @@ -147,7 +147,7 @@ final void drawMask (SpriteFrame frm, int sx, int sy, int scale, int x0, int y0, void renderEnt (MapEntity e, optional MapEntity other) { if (!e) return; - Video.color = 0x7f_ff_ff_ff; + GLVideo.color = 0x7f_ff_ff_ff; e.drawWithOfs(0, 0, scale, 0); bool doMirror; int fx0, fy0, fx1, fy1; @@ -161,18 +161,18 @@ void renderEnt (MapEntity e, optional MapEntity other) { //writeln("fx0=", fx0, "; fy0=", fy0, "; fx1=", fx1, "; fy1=", fy1); drawMask(frm, e.ix*scale, e.iy*scale, scale, fx0, fy0, fx1-1, fy1-1, -1, doMirror); } - Video.color = 0x00_7f_ff; - Video.drawRect(e.x0*scale, e.y0*scale, e.width*scale, e.height*scale); + GLVideo.color = 0x00_7f_ff; + GLVideo.drawRect(e.x0*scale, e.y0*scale, e.width*scale, e.height*scale); /* - Video.color = 0xff_00_ff; - Video.drawRect(e.ix*scale, e.iy*scale, 32*scale, 32*scale); + GLVideo.color = 0xff_00_ff; + GLVideo.drawRect(e.ix*scale, e.iy*scale, 32*scale, 32*scale); */ } void sprTestRender () { - Video.color = 0xff_ff_ff; - Video.clearScreen(); + GLVideo.color = 0xff_ff_ff; + GLVideo.clearScreen(); foreach (MapObject e; ent) e.setCollisionBoundsFromFrame(); @@ -187,8 +187,8 @@ void sprTestRender () { // ////////////////////////////////////////////////////////////////////////// // final void onDraw () { - if (Video.frameTime == 0) { - Video.requestRefresh(); + if (GLVideo.frameTime == 0) { + GLVideo.requestRefresh(); } sprTestRender(); @@ -202,7 +202,7 @@ int escCount; final void onEvent (ref event_t evt) { //writeln(va("%x", evt.buildModMask), "; ctrl:", evt.bCtrl, "; alt:", evt.bAlt, "; shift:", evt.bShift, "; hyper:", evt.bHyper, "; LMB:", evt.bLMB, "; RMB:", evt.bRMB, "; MMB:", evt.bMMB); - if (evt.type == ev_closequery) { Video.requestQuit(); return; } + if (evt.type == ev_closequery) { GLVideo.requestQuit(); return; } if (evt.type == ev_winfocus) { if (!evt.focused) escCount = 0; @@ -212,7 +212,7 @@ final void onEvent (ref event_t evt) { if (evt.type == ev_keyup && evt.keycode != K_ESCAPE) escCount = 0; if (evt.type == ev_keyup && evt.keycode == K_ESCAPE) { - if (++escCount == 2) Video.requestQuit(); + if (++escCount == 2) GLVideo.requestQuit(); return; } @@ -230,7 +230,7 @@ final void onEvent (ref event_t evt) { final void runIn () { - Video.frameTime = 0; // unlimited FPS + GLVideo.frameTime = 0; // unlimited FPS sprStore = SpawnObject(SpriteStore); sprStore.bDumpLoaded = false; @@ -240,11 +240,11 @@ final void runIn () { sprInit(); - Video.swapInterval = 1; - //Video.openScreen("Spelunky/VaVoom C", GameLevel::TilesWidth*16, GameLevel::TilesHeight*16); - Video.openScreen("Spelunky/VaVoom C", 320*3, 240*3); - Video.runEventLoop(); - Video.closeScreen(); + GLVideo.swapInterval = 1; + //GLVideo.openScreen("Spelunky/VaVoom C", GameLevel::TilesWidth*16, GameLevel::TilesHeight*16); + GLVideo.openScreen("Spelunky/VaVoom C", 320*3, 240*3); + GLVideo.runEventLoop(); + GLVideo.closeScreen(); } diff --git a/roomEnd.vc b/roomEnd.vc index a94c525..1f775b2 100644 --- a/roomEnd.vc +++ b/roomEnd.vc @@ -585,23 +585,23 @@ void winCutscenePlayerControl (PlayerPawn plr) { void renderWinCutsceneOverlay () { if (inWinCutscene == 3) { if (winSceneDrawStatus > 0) { - Video.color = 0xff_ff_ff; + GLVideo.color = 0xff_ff_ff; sprStore.loadFont('sFont'); //draw_set_font(global.myFont); //draw_set_color(txtCol); drawTextAt(64, 32, "YOU MADE IT!"); sprStore.loadFont('sFontSmall'); //draw_set_font(global.myFontSmall); if (global.config.gameMode == GameConfig::GameMode.Vanilla) { - Video.color = 0xff_ff_00; //draw_set_color(c_yellow); + GLVideo.color = 0xff_ff_00; //draw_set_color(c_yellow); drawTextAt(64, 48, "Classic Mode done!"); } else { - Video.color = 0x00_80_80; //draw_set_color(c_teal); + GLVideo.color = 0x00_80_80; //draw_set_color(c_teal); if (global.config.bizarrePlus) drawTextAt(64, 48, "Bizarre Mode Plus done!"); else drawTextAt(64, 48, "Bizarre Mode done!"); //draw_set_color(c_white); } if (!global.usedShortcut) { - Video.color = 0xc0_c0_c0; //draw_set_color(c_silver); + GLVideo.color = 0xc0_c0_c0; //draw_set_color(c_silver); drawTextAt(64, 56, "No shortcuts used!"); //draw_set_color(c_yellow); } @@ -610,19 +610,19 @@ void renderWinCutsceneOverlay () { if (winSceneDrawStatus > 1) { sprStore.loadFont('sFontSmall'); //draw_set_font(global.myFontSmall); //draw_set_color(txtCol); - Video.color = 0xff_ff_ff; + GLVideo.color = 0xff_ff_ff; drawTextAt(64, 64, "FINAL SCORE:"); } if (winSceneDrawStatus > 2) { sprStore.loadFont('sFont'); //draw_set_font(global.myFont); - Video.color = 0xff_ff_ff; //draw_set_color(c_white); + GLVideo.color = 0xff_ff_ff; //draw_set_color(c_white); drawTextAt(64, 72, va("$%d", winMoneyCount)); } if (winSceneDrawStatus > 4) { sprStore.loadFont('sFontSmall'); //draw_set_font(global.myFontSmall); - Video.color = 0xff_ff_ff; //draw_set_color(c_white); + GLVideo.color = 0xff_ff_ff; //draw_set_color(c_white); drawTextAt(64, 96, va("Time: %s", time2str(winTime/30))); /* draw_set_color(c_white); @@ -633,34 +633,34 @@ void renderWinCutsceneOverlay () { if (winSceneDrawStatus > 5) { sprStore.loadFont('sFontSmall'); //draw_set_font(global.myFontSmall); - Video.color = 0xff_ff_ff; //draw_set_color(txtCol); + GLVideo.color = 0xff_ff_ff; //draw_set_color(txtCol); drawTextAt(64, 96+8, "Kills: "); - Video.color = 0xff_ff_ff; //draw_set_color(c_white); + GLVideo.color = 0xff_ff_ff; //draw_set_color(c_white); drawTextAt(96+24, 96+8, va("%s", stats.countKills())); } if (winSceneDrawStatus > 6) { sprStore.loadFont('sFontSmall'); //draw_set_font(global.myFontSmall); - Video.color = 0xff_ff_ff; //draw_set_color(txtCol); + GLVideo.color = 0xff_ff_ff; //draw_set_color(txtCol); drawTextAt(64, 96+16, "Saves: "); - Video.color = 0xff_ff_ff; //draw_set_color(c_white); + GLVideo.color = 0xff_ff_ff; //draw_set_color(c_white); drawTextAt(96+24, 96+16, va("%s", stats.damselsSaved)); } if (winFadeOut) { - Video.color = (255-clamp(winFadeLevel, 0, 255))<<24; - Video.fillRect(0, 0, Video.screenWidth, Video.screenHeight); + GLVideo.color = (255-clamp(winFadeLevel, 0, 255))<<24; + GLVideo.fillRect(0, 0, GLVideo.screenWidth, GLVideo.screenHeight); } if (winSceneDrawStatus == 8) { sprStore.loadFont('sFontSmall'); //draw_set_font(global.myFontSmall); - Video.color = 0xff_ff_ff; //draw_set_color(c_white); + GLVideo.color = 0xff_ff_ff; //draw_set_color(c_white); string lastString; if (global.config.gameMode == GameConfig::GameMode.Vanilla) { - Video.color = 0xff_ff_00; //draw_set_color(c_yellow); + GLVideo.color = 0xff_ff_00; //draw_set_color(c_yellow); lastString = "YOU SHALL BE REMEMBERED AS A HERO."; } else { - Video.color = 0x00_ff_ff; + GLVideo.color = 0x00_ff_ff; if (global.config.bizarrePlus) lastString = "ANOTHER LEGENDARY ADVENTURE!"; else lastString = "YOUR DISCOVERIES WILL BE CELEBRATED!"; } diff --git a/roomIntro.vc b/roomIntro.vc index 2ff9538..17104b6 100644 --- a/roomIntro.vc +++ b/roomIntro.vc @@ -123,7 +123,7 @@ final void renderTitleCutscenePhrase (int phnum, int alpha) { default: return; } sprStore.loadFont('sFontSmall'); - Video.color = 0xff_ff_ff|(clamp(255-alpha, 0, 255)<<24); + GLVideo.color = 0xff_ff_ff|(clamp(255-alpha, 0, 255)<<24); auto twdt = sprStore.getTextWidth(ss); drawTextAt((320-twdt)/2, 80-16-16+phnum*16, ss); } @@ -136,8 +136,8 @@ void renderTitleCutsceneOverlay () { } if (introPhase == -1) { - Video.color = clamp(introPhaseTimer, 0, 255)<<24; - Video.fillRect(0, 0, Video.screenWidth, Video.screenHeight); + GLVideo.color = clamp(introPhaseTimer, 0, 255)<<24; + GLVideo.fillRect(0, 0, GLVideo.screenWidth, GLVideo.screenHeight); } if (introPhase >= 1) { @@ -147,11 +147,11 @@ void renderTitleCutsceneOverlay () { } if (introPhase == 7) { - Video.color = clamp(introPhaseTimer, 0, 255)<<24; - Video.fillRect(0, 0, Video.screenWidth, Video.screenHeight); + GLVideo.color = clamp(introPhaseTimer, 0, 255)<<24; + GLVideo.fillRect(0, 0, GLVideo.screenWidth, GLVideo.screenHeight); } - Video.color = 0xff_ff_ff; + GLVideo.color = 0xff_ff_ff; } diff --git a/spelunky_main.vc b/spelunky_main.vc index 1eed9c2..5352163 100644 --- a/spelunky_main.vc +++ b/spelunky_main.vc @@ -16,7 +16,7 @@ * If not, please obtain a new copy of Spelunky from * **********************************************************************************/ -import 'Video'; +import 'GLVideo'; import 'SoundSys'; import 'Geom'; import 'Game'; @@ -830,8 +830,8 @@ final bool loadGame (string gmname) { level.onLevelExitedCB = &levelExited; level.onCameraTeleported = &cameraTeleportedCB; - //level.viewWidth = Video.screenWidth; - //level.viewHeight = Video.screenHeight; + //level.viewWidth = GLVideo.screenWidth; + //level.viewHeight = GLVideo.screenHeight; level.viewWidth = 320*3; level.viewHeight = 240*3; @@ -1112,16 +1112,16 @@ final void cameraTeleportedCB () { final void setColorByIdx (bool isset, int col) { if (col == -666) { // missed collision: red - Video.color = (isset ? 0x3f_ff_00_00 : 0xcf_ff_00_00); + GLVideo.color = (isset ? 0x3f_ff_00_00 : 0xcf_ff_00_00); } else if (col == -999) { // superfluous collision: blue - Video.color = (isset ? 0x3f_00_00_ff : 0xcf_00_00_ff); + GLVideo.color = (isset ? 0x3f_00_00_ff : 0xcf_00_00_ff); } else if (col <= 0) { // no collision: yellow - Video.color = (isset ? 0x3f_ff_ff_00 : 0xcf_ff_ff_00); + GLVideo.color = (isset ? 0x3f_ff_ff_00 : 0xcf_ff_ff_00); } else if (col > 0) { // collision: green - Video.color = (isset ? 0x3f_00_ff_00 : 0xcf_00_ff_00); + GLVideo.color = (isset ? 0x3f_00_ff_00 : 0xcf_00_ff_00); } } @@ -1133,8 +1133,8 @@ final void drawMaskSimple (SpriteFrame frm, int xofs, int yofs) { int scale = global.config.scale; int bx0, by0, bx1, by1; frm.getBBox(out bx0, out by0, out bx1, out by1, false); - Video.color = 0x7f_00_00_ff; - Video.fillRect(xofs+bx0*scale, yofs+by0*scale, (bx1-bx0+1)*scale, (by1-by0+1)*scale); + GLVideo.color = 0x7f_00_00_ff; + GLVideo.fillRect(xofs+bx0*scale, yofs+by0*scale, (bx1-bx0+1)*scale, (by1-by0+1)*scale); if (!cm.isEmptyMask) { //writeln(cm.mask.length, "; ", cm.width, "x", cm.height, "; (", cm.x0, ",", cm.y0, ")-(", cm.x1, ",", cm.y1, ")"); foreach (int iy; 0..cm.height) { @@ -1143,8 +1143,8 @@ final void drawMaskSimple (SpriteFrame frm, int xofs, int yofs) { foreach (int dx; 0..32) { int xx = ix*32+dx; if (v < 0) { - Video.color = 0x3f_00_ff_00; - Video.fillRect(xofs+xx*scale, yofs+iy*scale, scale, scale); + GLVideo.color = 0x3f_00_ff_00; + GLVideo.fillRect(xofs+xx*scale, yofs+iy*scale, scale, scale); } v <<= 1; } @@ -1160,11 +1160,11 @@ final void drawMaskSimple (SpriteFrame frm, int xofs, int yofs) { //if (xx >= frm.bx && xx < frm.bx+frm.bw && iy >= frm.by && iy < frm.by+frm.bh) { if (xx >= x0 && xx <= x1 && iy >= y0 && iy <= y1) { setColorByIdx(true, col); - if (col <= 0) Video.color = 0xaf_ff_ff_00; + if (col <= 0) GLVideo.color = 0xaf_ff_ff_00; } else { - Video.color = 0xaf_00_ff_00; + GLVideo.color = 0xaf_00_ff_00; } - Video.fillRect(sx+xx*scale, sy+iy*scale, scale, scale); + GLVideo.fillRect(sx+xx*scale, sy+iy*scale, scale, scale); } } } @@ -1172,9 +1172,9 @@ final void drawMaskSimple (SpriteFrame frm, int xofs, int yofs) { /* if (frm.bw > 0 && frm.bh > 0) { setColorByIdx(true, col); - Video.fillRect(x0+frm.bx*scale, y0+frm.by*scale, frm.bw*scale, frm.bh*scale); - Video.color = 0xff_00_00; - Video.drawRect(x0+frm.bx*scale, y0+frm.by*scale, frm.bw*scale, frm.bh*scale); + GLVideo.fillRect(x0+frm.bx*scale, y0+frm.by*scale, frm.bw*scale, frm.bh*scale); + GLVideo.color = 0xff_00_00; + GLVideo.drawRect(x0+frm.bx*scale, y0+frm.by*scale, frm.bw*scale, frm.bh*scale); } */ } @@ -1278,19 +1278,19 @@ void drawTotalsList (string pfx, ref array!(GameStats::TotalItem) arr) { // "upscroll" mark if (topItem > 0) { - Video.color = 0x3f_ff_ff_00; + GLVideo.color = 0x3f_ff_ff_00; auto spr = sprStore['sPageUp']; spr.frames[0].blitAt(currX-28, currY, scale); } // "downscroll" mark if (topItem+visItems < arr.length) { - Video.color = 0x3f_ff_ff_00; + GLVideo.color = 0x3f_ff_ff_00; auto spr = sprStore['sPageDown']; spr.frames[0].blitAt(currX-28, endY+3/*-sprStore.getFontHeight(scale)*/, scale); } - Video.color = 0xff_ff_00; + GLVideo.color = 0xff_ff_00; int hiColor = 0x00_ff_00; int hiColor1 = 0xf_ff_ff; @@ -1308,11 +1308,11 @@ void drawStatsScreen () { sprStore.loadFont('sFontSmall'); - Video.color = 0xff_ff_ff; + GLVideo.color = 0xff_ff_ff; level.drawTextAtS3Centered(240-2-8, "ESC-RETURN F10-QUIT CTRL+DEL-SUICIDE"); level.drawTextAtS3Centered(2, "~O~PTIONS REDEFINE ~K~EYS ~S~TATISTICS", 0xff_7f_00); - Video.color = 0xff_ff_00; + GLVideo.color = 0xff_ff_00; int hiColor = 0x00_ff_00; switch (drawStats) { @@ -1378,9 +1378,9 @@ void drawStatsScreen () { void onDraw () { - if (Video.frameTime == 0) { + if (GLVideo.frameTime == 0) { onTimePasses(); - Video.requestRefresh(); + GLVideo.requestRefresh(); } if (!level) return; @@ -1388,56 +1388,56 @@ void onDraw () { if (level.framesProcessedFromLastClear < 1) return; calcMouseMapCoords(); - Video.stencil = true; // you NEED this to be set! (stencil buffer is used for lighting) - Video.clearScreen(); - Video.stencil = false; - Video.color = 0xff_ff_ff; - Video.textureFiltering = false; + GLVideo.stencil = true; // you NEED this to be set! (stencil buffer is used for lighting) + GLVideo.clearScreen(); + GLVideo.stencil = false; + GLVideo.color = 0xff_ff_ff; + GLVideo.textureFiltering = false; // don't touch framebuffer alpha - Video.colorMask = Video::CMask.Colors; + GLVideo.colorMask = GLVideo::CMask.Colors; - Video::ScissorRect scsave; + GLVideo::ScissorRect scsave; bool doRestoreGL = false; /* if (level.viewOffsetX > 0 || level.viewOffsetY > 0) { doRestoreGL = true; - Video.getScissor(scsave); - Video.scissorCombine(level.viewOffsetX, level.viewOffsetY, level.viewWidth, level.viewHeight); - Video.glPushMatrix(); - Video.glTranslate(level.viewOffsetX, level.viewOffsetY); + GLVideo.getScissor(scsave); + GLVideo.scissorCombine(level.viewOffsetX, level.viewOffsetY, level.viewWidth, level.viewHeight); + GLVideo.glPushMatrix(); + GLVideo.glTranslate(level.viewOffsetX, level.viewOffsetY); } */ - if (level.viewWidth != Video.screenWidth || level.viewHeight != Video.screenHeight) { + if (level.viewWidth != GLVideo.screenWidth || level.viewHeight != GLVideo.screenHeight) { doRestoreGL = true; - float scx = float(Video.screenWidth)/float(level.viewWidth); - float scy = float(Video.screenHeight)/float(level.viewHeight); + float scx = float(GLVideo.screenWidth)/float(level.viewWidth); + float scy = float(GLVideo.screenHeight)/float(level.viewHeight); float scale = fmin(scx, scy); int calcedW = trunc(level.viewWidth*scale); int calcedH = trunc(level.viewHeight*scale); - Video.getScissor(scsave); - int ofsx = (Video.screenWidth-calcedW)/2; - int ofsy = (Video.screenHeight-calcedH)/2; - Video.scissorCombine(ofsx, ofsy, calcedW, calcedH); - Video.glPushMatrix(); - Video.glTranslate(ofsx, ofsy); - Video.glScale(scale, scale); + GLVideo.getScissor(scsave); + int ofsx = (GLVideo.screenWidth-calcedW)/2; + int ofsy = (GLVideo.screenHeight-calcedH)/2; + GLVideo.scissorCombine(ofsx, ofsy, calcedW, calcedH); + GLVideo.glPushMatrix(); + GLVideo.glTranslate(ofsx, ofsy); + GLVideo.glScale(scale, scale); } - //level.viewOffsetX = (Video.screenWidth-320*3)/2; - //level.viewOffsetY = (Video.screenHeight-240*3)/2; + //level.viewOffsetX = (GLVideo.screenWidth-320*3)/2; + //level.viewOffsetY = (GLVideo.screenHeight-240*3)/2; if (fullscreen) { /* level.viewOffsetX = 0; level.viewOffsetY = 0; - Video.glScale(float(Video.screenWidth)/float(level.viewWidth), float(Video.screenHeight)/float(level.viewHeight)); + GLVideo.glScale(float(GLVideo.screenWidth)/float(level.viewWidth), float(GLVideo.screenHeight)/float(level.viewHeight)); */ /* - float scx = float(Video.screenWidth)/float(level.viewWidth); - float scy = float(Video.screenHeight)/float(level.viewHeight); - Video.glScale(float(Video.screenWidth)/float(level.viewWidth), 1); + float scx = float(GLVideo.screenWidth)/float(level.viewWidth); + float scy = float(GLVideo.screenHeight)/float(level.viewHeight); + GLVideo.glScale(float(GLVideo.screenWidth)/float(level.viewWidth), 1); */ } @@ -1450,25 +1450,25 @@ void onDraw () { if (mouseLevelX != int.min) { int scale = level.global.scale; if (renderMouseRect) { - Video.color = 0xcf_ff_ff_00; - Video.fillRect(mouseLevelX*scale-viewCameraPos.x, mouseLevelY*scale-viewCameraPos.y, 12*scale, 14*scale); + GLVideo.color = 0xcf_ff_ff_00; + GLVideo.fillRect(mouseLevelX*scale-viewCameraPos.x, mouseLevelY*scale-viewCameraPos.y, 12*scale, 14*scale); } if (renderMouseTile) { - Video.color = 0xaf_ff_00_00; - Video.fillRect((mouseLevelX&~15)*scale-viewCameraPos.x, (mouseLevelY&~15)*scale-viewCameraPos.y, 16*scale, 16*scale); + GLVideo.color = 0xaf_ff_00_00; + GLVideo.fillRect((mouseLevelX&~15)*scale-viewCameraPos.x, (mouseLevelY&~15)*scale-viewCameraPos.y, 16*scale, 16*scale); } } } switch (doGameSavingPlaying) { case Replay.Saving: - Video.color = 0x7f_00_ff_00; + GLVideo.color = 0x7f_00_ff_00; sprStore.loadFont('sFont'); sprStore.renderText(level.viewWidth-sprStore.getTextWidth("S", 2)-2, 2, "S", 2); break; case Replay.Replaying: if (level.player && !level.player.dead) { - Video.color = 0x7f_ff_00_00; + GLVideo.color = 0x7f_ff_00_00; sprStore.loadFont('sFont'); sprStore.renderText(level.viewWidth-sprStore.getTextWidth("R", 2)-2, 2, "R", 2); int th = sprStore.getFontHeight(2); @@ -1481,7 +1481,7 @@ void onDraw () { break; default: if (saveGameSession) { - Video.color = 0x7f_ff_7f_00; + GLVideo.color = 0x7f_ff_7f_00; sprStore.loadFont('sFont'); sprStore.renderText(level.viewWidth-sprStore.getTextWidth("S", 2)-2, 2, "S", 2); } @@ -1491,14 +1491,14 @@ void onDraw () { if (level.player && level.player.dead && !showHelp) { // darken - Video.color = 0x8f_00_00_00; - Video.fillRect(0, 0, level.viewWidth, level.viewHeight); + GLVideo.color = 0x8f_00_00_00; + GLVideo.fillRect(0, 0, level.viewWidth, level.viewHeight); // draw text if (drawStats) { drawStatsScreen(); } else { if (true /*level.inWinCutscene == 0*/) { - Video.color = 0xff_ff_ff; + GLVideo.color = 0xff_ff_ff; sprStore.loadFont('sFontSmall'); string kmsg = va((level.stats.newMoneyRecord ? "NEW HIGH SCORE: |%d|\n" : "SCORE: |%d|\n")~ "\n"~ @@ -1522,7 +1522,7 @@ void onDraw () { #ifdef MASK_TEST { - Video.color = 0xff_7f_00; + GLVideo.color = 0xff_7f_00; sprStore.loadFont('sFontSmall'); sprStore.renderText(8, level.viewHeight-20, va("%s; FRAME:%d", (smask.precise ? "PRECISE" : "HITBOX"), maskFrame), 2); auto spf = smask.frames[maskFrame]; @@ -1545,8 +1545,8 @@ void onDraw () { /* level.touchTilesWithMask(mapX, mapY, spf, delegate bool (MapTile t) { if (t.spectral || !t.isInstanceAlive) return false; - Video.color = 0x7f_ff_00_00; - Video.fillRect(t.x0*global.config.scale-viewCameraPos.x, t.y0*global.config.scale-viewCameraPos.y, t.width*global.config.scale, t.height*global.config.scale); + GLVideo.color = 0x7f_ff_00_00; + GLVideo.fillRect(t.x0*global.config.scale-viewCameraPos.x, t.y0*global.config.scale-viewCameraPos.y, t.width*global.config.scale, t.height*global.config.scale); auto tsf = t.getSpriteFrame(); auto spf = smask.frames[maskFrame]; @@ -1562,46 +1562,46 @@ void onDraw () { }); */ level.touchObjectsWithMask(mapX, mapY, spf, delegate bool (MapObject t) { - Video.color = 0x7f_ff_00_00; - Video.fillRect(t.x0*global.config.scale-viewCameraPos.x, t.y0*global.config.scale-viewCameraPos.y, t.width*global.config.scale, t.height*global.config.scale); + GLVideo.color = 0x7f_ff_00_00; + GLVideo.fillRect(t.x0*global.config.scale-viewCameraPos.x, t.y0*global.config.scale-viewCameraPos.y, t.width*global.config.scale, t.height*global.config.scale); return false; }); // drawMaskSimple(spf, mapX*scale-xofs, mapY*scale-yofs); // mask - Video.color = 0xaf_ff_ff_ff; + GLVideo.color = 0xaf_ff_ff_ff; spf.blitAt(mapX*scale-xofs, mapY*scale-yofs, scale); - Video.color = 0xff_ff_00; - Video.drawRect((mapX+spf.bx)*scale-xofs, (mapY+spf.by)*scale-yofs, spf.bw*scale, spf.bh*scale); + GLVideo.color = 0xff_ff_00; + GLVideo.drawRect((mapX+spf.bx)*scale-xofs, (mapY+spf.by)*scale-yofs, spf.bw*scale, spf.bh*scale); // player colbox { bool doMirrorSelf; int fx0, fy0, fx1, fy1; auto pfm = level.player.getSpriteFrame(out doMirrorSelf, out fx0, out fy0, out fx1, out fy1); - Video.color = 0x7f_00_00_ff; - Video.fillRect((level.player.ix+fx0)*scale-xofs, (level.player.iy+fy0)*scale-yofs, (fx1-fx0)*scale, (fy1-fy0)*scale); + GLVideo.color = 0x7f_00_00_ff; + GLVideo.fillRect((level.player.ix+fx0)*scale-xofs, (level.player.iy+fy0)*scale-yofs, (fx1-fx0)*scale, (fy1-fy0)*scale); } } #endif if (showHelp) { - Video.color = 0x8f_00_00_00; - Video.fillRect(0, 0, level.viewWidth, level.viewHeight); + GLVideo.color = 0x8f_00_00_00; + GLVideo.fillRect(0, 0, level.viewWidth, level.viewHeight); if (optionsPane) { optionsPane.drawWithOfs(optionsPaneOfs.x+32, optionsPaneOfs.y+32); } else { if (drawStats) { drawStatsScreen(); } else { - Video.color = 0xff_ff_00; - //if (showHelp > 1) Video.color = 0xaf_ff_ff_00; + GLVideo.color = 0xff_ff_00; + //if (showHelp > 1) GLVideo.color = 0xaf_ff_ff_00; if (showHelp == 1) { int msx, msy, ww, wh; - Video.getMousePos(out msx, out msy); - Video.getRealWindowSize(out ww, out wh); + GLVideo.getMousePos(out msx, out msy); + GLVideo.getRealWindowSize(out ww, out wh); if (msx >= 0 && msy >= 0 && msx < ww && msy < wh) { sprStore.loadFont('sFontSmall'); - Video.color = 0xff_ff_00; + GLVideo.color = 0xff_ff_00; sprStore.renderTextWrapped(16, 16, (320-16)*2, "F1: show this help\n"~ "O : options\n"~ @@ -1633,14 +1633,14 @@ void onDraw () { //sprStore.renderText(16, 16, "SPELUNKY!", 2); if (doRestoreGL) { - Video.setScissor(scsave); - Video.glPopMatrix(); + GLVideo.setScissor(scsave); + GLVideo.glPopMatrix(); } if (TigerEye) { - Video.color = 0xaf_ff_ff_ff; - texTigerEye.blitAt(Video.screenWidth-texTigerEye.width-2, Video.screenHeight-texTigerEye.height-2); + GLVideo.color = 0xaf_ff_ff_ff; + texTigerEye.blitAt(GLVideo.screenWidth-texTigerEye.width-2, GLVideo.screenHeight-texTigerEye.height-2); } } @@ -1663,7 +1663,7 @@ final void calcMouseMapCoords () { final void onEvent (ref event_t evt) { - if (evt.type == ev_closequery) { Video.requestQuit(); return; } + if (evt.type == ev_closequery) { GLVideo.requestQuit(); return; } if (evt.type == ev_winfocus) { if (level && !evt.focused) { @@ -1671,7 +1671,7 @@ final void onEvent (ref event_t evt) { } if (evt.focused) { //writeln("FOCUS!"); - Video.getMousePos(out mouseX, out mouseY); + GLVideo.getMousePos(out mouseX, out mouseY); } return; } @@ -1755,7 +1755,7 @@ final void onEvent (ref event_t evt) { switch (evt.keycode) { case K_F1: if (showHelp == 2 && level) level.gameShowHelp = !level.gameShowHelp; if (level.gameShowHelp) level.gameHelpScreen = 0; return; case K_F2: if (showHelp != 2) unpauseGame(); return; - case K_F10: Video.requestQuit(); return; + case K_F10: GLVideo.requestQuit(); return; case K_F11: if (showHelp != 2) showHelp = 3-showHelp; return; case K_BACKQUOTE: @@ -2128,8 +2128,8 @@ void levelExited () { void closeVideo () { - if (fullscreen && Video.isInitialized) Video.showMouseCursor(); - Video.closeScreen(); + if (fullscreen && GLVideo.isInitialized) GLVideo.showMouseCursor(); + GLVideo.closeScreen(); } @@ -2147,28 +2147,28 @@ void initializeVideo () { case GameConfig::RealFSModes.VM_1920x1200: wdt = 1920; hgt = 1200; break; } } - Video.openScreen("Spelunky/VaVoom C", wdt, hgt, (fullscreen ? global.config.fsmode : 0)); - if (Video.realStencilBits < 8) { - Video.closeScreen(); + GLVideo.openScreen("Spelunky/VaVoom C", wdt, hgt, (fullscreen ? global.config.fsmode : 0)); + if (GLVideo.realStencilBits < 8) { + GLVideo.closeScreen(); FatalError("=== YOUR GPU SUX! ===\nno stencil buffer!"); } /* - if (!loserGPU && !Video.framebufferHasAlpha) { - Video.closeScreen(); + if (!loserGPU && !GLVideo.framebufferHasAlpha) { + GLVideo.closeScreen(); FatalError("=== YOUR GPU SUX! ===\nno alpha channel in framebuffer!\nRun the game with \"--loser-gpu\" arg if you still want to play."); } */ - if (!Video.framebufferHasAlpha) { + if (!GLVideo.framebufferHasAlpha) { loserGPU = true; if (level) level.loserGPU = true; } /* - if (!Video.glHasNPOT) { - Video.closeScreen(); + if (!GLVideo.glHasNPOT) { + GLVideo.closeScreen(); FatalError("=== YOUR GPU SUX! ===\nno NPOT texture support!"); } */ - if (fullscreen) Video.hideMouseCursor(); + if (fullscreen) GLVideo.hideMouseCursor(); } @@ -2180,7 +2180,7 @@ void toggleFullscreen () { final void runGameLoop () { - Video.frameTime = 0; // unlimited FPS + GLVideo.frameTime = 0; // unlimited FPS lastThinkerTime = 0; sprStore = SpawnObject(SpriteStore); @@ -2230,8 +2230,8 @@ final void runGameLoop () { level.viewWidth = 320*3; level.viewHeight = 240*3; - Video.swapInterval = (global.config.optVSync ? 1 : 0); - //Video.openScreen("Spelunky/VaVoom C", 320*(fullscreen ? 4 : 3), 240*(fullscreen ? 4 : 3), fullscreen); + GLVideo.swapInterval = (global.config.optVSync ? 1 : 0); + //GLVideo.openScreen("Spelunky/VaVoom C", 320*(fullscreen ? 4 : 3), 240*(fullscreen ? 4 : 3), fullscreen); fullscreen = global.config.startFullscreen; initializeVideo(); @@ -2299,9 +2299,9 @@ final void runGameLoop () { //level.centerViewAtPlayer(); teleportCameraAt(level.viewStart); - //writeln(Video.swapInterval); + //writeln(GLVideo.swapInterval); - Video.runEventLoop(); + GLVideo.runEventLoop(); closeVideo(); SoundSystem.Shutdown(); diff --git a/uisimple.vc b/uisimple.vc index 0f3df1f..61a04ca 100644 --- a/uisimple.vc +++ b/uisimple.vc @@ -29,7 +29,7 @@ override void Destroy () { final int buildColor (int clr) { - return (clr&0xff_ff_ff)|(Video.color&0xff_00_00_00); + return (clr&0xff_ff_ff)|(GLVideo.color&0xff_00_00_00); } @@ -40,7 +40,7 @@ void setTextColor (int clr) { alpha = clamp(alpha > 127 ? 255-(alpha-128)*2 : alpha*2, 0, 255); alpha = clamp(alpha-alpha/4, 0, 255); } - Video.color = (clr&0xff_ff_ff)|(alpha<<24); + GLVideo.color = (clr&0xff_ff_ff)|(alpha<<24); } @@ -601,13 +601,13 @@ void drawWithOfs (int xofs, int yofs) { // "upscroll" mark if (topItem > 0) { - Video.color = 0x3f_ff_ff_00; + GLVideo.color = 0x3f_ff_ff_00; auto spr = sprStore['sPageUp']; spr.frames[0].blitAt(xofs-9*scale, yofs, scale); } // "downscroll" mark if (topItem+visLines < controls.length) { - Video.color = 0x3f_ff_ff_00; + GLVideo.color = 0x3f_ff_ff_00; auto spr = sprStore['sPageDown']; spr.frames[0].blitAt(xofs-9*scale, yofs+getLineHeight()*(visLines-1)-scale, scale); } @@ -626,7 +626,7 @@ void drawWithOfs (int xofs, int yofs) { string help = controls[currItem].help; yofs += getLineHeight(); if (help) { - Video.color = 0xff_ff_00; + GLVideo.color = 0xff_ff_00; sprStore.renderTextWrapped(xofs, yofs, 36*8*scale, help, scale); } } -- 2.11.4.GIT