diff --git a/TheForceEngine/TFE_DarkForces/GameUI/agentMenu.cpp b/TheForceEngine/TFE_DarkForces/GameUI/agentMenu.cpp index 82808c720..dcae81f58 100644 --- a/TheForceEngine/TFE_DarkForces/GameUI/agentMenu.cpp +++ b/TheForceEngine/TFE_DarkForces/GameUI/agentMenu.cpp @@ -245,7 +245,7 @@ namespace TFE_DarkForces s_buttonPressed = AGENT_REMOVE; s_buttonHover = JTRUE; } - else if (TFE_Input::keyPressed(KEY_D)) // DOS + else if (TFE_Input::keyPressed(s_langKeys->k_quit)) // DOS { s_buttonPressed = AGENT_EXIT; s_buttonHover = JTRUE; @@ -449,8 +449,13 @@ namespace TFE_DarkForces void agentMenu_load(LangHotkeys* langKeys) { + s_langKeys = langKeys; + FilePath filePath; - if (!TFE_Paths::getFilePath("AGENTMNU.LFD", &filePath)) { return; } + if (!TFE_Paths::getFilePath("AGENTMNU.LFD", &filePath)) { + TFE_System::logWrite(LOG_ERROR, "AgentMenu", "agentMenu_load: AGENTMNU.LFD NOT FOUND."); + return; + } Archive* archive = Archive::getArchive(ARCHIVE_LFD, "AGENTMNU", filePath.path); TFE_Paths::addLocalArchive(archive); @@ -459,8 +464,6 @@ namespace TFE_DarkForces s_agentDlgCount = getFramesFromAnim("agentdlg.anim", &s_agentDlgFrames); getFrameFromDelt("cursor.delt", &s_cursor); TFE_Paths::removeLastArchive(); - - s_langKeys = langKeys; } void agentMenu_startup() diff --git a/TheForceEngine/TFE_DarkForces/darkForcesMain.cpp b/TheForceEngine/TFE_DarkForces/darkForcesMain.cpp index ca634e3e0..9d5236728 100644 --- a/TheForceEngine/TFE_DarkForces/darkForcesMain.cpp +++ b/TheForceEngine/TFE_DarkForces/darkForcesMain.cpp @@ -71,6 +71,7 @@ namespace TFE_DarkForces "SOUNDS.GOB", "TEXTURES.GOB", "SPRITES.GOB", + "WEAPONS.GOB", // Mac data has weapons in here instead of textures }; enum GameConstants @@ -1077,6 +1078,8 @@ namespace TFE_DarkForces TFE_Paths::addLocalSearchPath(""); TFE_Paths::addLocalSearchPath("LFD/"); // Dark Forces also adds C:/ and C:/LFD but TFE won't be doing that for obvious reasons... + TFE_Paths::addLocalSearchPath("Cutscenes/"); + // mac data has LFDs in Cutscenes folder // Add some extra directories, if they exist. // Obviously these were not in the original code. @@ -1119,7 +1122,12 @@ namespace TFE_DarkForces } else { - TFE_System::logWrite(LOG_ERROR, "Dark Forces Main", "Cannot find required game data - '%s'.", c_gobFileNames[i]); + if (strcmp(c_gobFileNames[i],"WEAPONS.GOB") == 0) { + TFE_System::logWrite(LOG_WARNING, "Dark Forces Main", "Cannot find required mac game data - '%s'.", c_gobFileNames[i]); + } + else { + TFE_System::logWrite(LOG_ERROR, "Dark Forces Main", "Cannot find required game data - '%s'.", c_gobFileNames[i]); + } } } } diff --git a/TheForceEngine/TFE_DarkForces/hud.cpp b/TheForceEngine/TFE_DarkForces/hud.cpp index 2b63f6a1c..0f7789d17 100644 --- a/TheForceEngine/TFE_DarkForces/hud.cpp +++ b/TheForceEngine/TFE_DarkForces/hud.cpp @@ -373,7 +373,9 @@ namespace TFE_DarkForces { hud_setupToggleAnim1(JTRUE); } - offscreenBuffer_drawTexture(s_cachedHudRight, s_hudLightOff, 19, 0); + u16 hudWidth = s_hudStatusL->width; // should be 76(dos) or 76*2 = 152(mac) + u16 hudDoubled = hudWidth == 76 ? 0 : 1; + offscreenBuffer_drawTexture(s_cachedHudRight, s_hudLightOff, 19 << hudDoubled, 0); } void hud_drawMessage(u8* framebuffer) @@ -471,6 +473,9 @@ namespace TFE_DarkForces hudScaleY = floatToFixed16(fixed16ToFloat(yScale) * hudSettings->scale); } + u16 hudWidth = s_hudStatusL->width; // should be 76(dos) or 76*2 = 152(mac) + u16 hudDoubled = hudWidth == 76 ? 0 : 1; + fixed16_16 x0, x1; if (hudSettings->hudPos == TFE_HUDPOS_4_3) { @@ -479,7 +484,7 @@ namespace TFE_DarkForces } else { - x0 = intToFixed16(dispWidth) - mul16(intToFixed16(s_cachedHudRight->width - 1), hudScaleX); + x0 = intToFixed16(dispWidth) - (mul16(intToFixed16(s_cachedHudRight->width - 1), hudScaleX) >> hudDoubled); x1 = 0; } x0 -= intToFixed16(hudSettings->pixelOffset[0]); @@ -490,13 +495,13 @@ namespace TFE_DarkForces y0 += intToFixed16(hudSettings->pixelOffset[2]); y1 += intToFixed16(hudSettings->pixelOffset[2]); - screenGPU_blitTextureScaled(s_hudStatusR, nullptr, x0, y0, hudScaleX, hudScaleY, 255); - screenGPU_blitTextureScaled(s_hudStatusL, nullptr, x1, y1, hudScaleX, hudScaleY, 255); + screenGPU_blitTextureScaled(s_hudStatusR, nullptr, x0, y0, hudScaleX >> hudDoubled, hudScaleY >> hudDoubled, 255); + screenGPU_blitTextureScaled(s_hudStatusL, nullptr, x1, y1, hudScaleX >> hudDoubled, hudScaleY >> hudDoubled, 255); if ((hudSettings->hudPos == TFE_HUDPOS_4_3 || hudSettings->pixelOffset[0] > 0 || hudSettings->pixelOffset[1] > 0) && s_hudCapLeft && s_hudCapRight) { screenGPU_blitTextureScaled(s_hudCapLeft, nullptr, x1 - mul16(intToFixed16(s_hudCapLeft->width - 1), hudScaleX), y1, hudScaleX, hudScaleY, 31); - screenGPU_blitTextureScaled(s_hudCapRight, nullptr, x0 + mul16(intToFixed16(s_hudStatusR->width), hudScaleX), y1, hudScaleX, hudScaleY, 31); + screenGPU_blitTextureScaled(s_hudCapRight, nullptr, x0 + mul16(intToFixed16(s_hudStatusR->width >> hudDoubled), hudScaleX), y1, hudScaleX, hudScaleY, 31); } // Energy @@ -525,10 +530,10 @@ namespace TFE_DarkForces { char lifeCountStr[8]; sprintf(lifeCountStr, "%1d", lifeCount); - + // box starts at x=104, y=52 fixed16_16 xPos = mul16(intToFixed16(52), hudScaleX) + x1; fixed16_16 yPos = mul16(intToFixed16(26), hudScaleY) + y1; - hud_drawStringGpu(s_hudHealthFont, xPos, yPos, hudScaleX, hudScaleY, lifeCountStr); + hud_drawStringGpu(s_hudHealthFont, xPos, yPos, hudScaleX >> hudDoubled, hudScaleY >> hudDoubled, lifeCountStr); s_rightHudShow = 4; } @@ -538,11 +543,11 @@ namespace TFE_DarkForces fixed16_16 yPos = y0; if (s_headlampActive) { - screenGPU_blitTextureScaled(s_hudLightOn, nullptr, xPos, yPos, hudScaleX, hudScaleY, 31); + screenGPU_blitTextureScaled(s_hudLightOn, nullptr, xPos, yPos, hudScaleX >> hudDoubled, hudScaleY >> hudDoubled, 31); } else { - screenGPU_blitTextureScaled(s_hudLightOff, nullptr, xPos, yPos, hudScaleX, hudScaleY, 31); + screenGPU_blitTextureScaled(s_hudLightOff, nullptr, xPos, yPos, hudScaleX >> hudDoubled, hudScaleY >> hudDoubled, 31); } s_rightHudShow = 4; } @@ -595,7 +600,7 @@ namespace TFE_DarkForces fixed16_16 xPos = mul16(intToFixed16(15), hudScaleX) + x1; fixed16_16 yPos = mul16(intToFixed16(26), hudScaleY) + y1; - hud_drawStringGpu(s_hudShieldFont, xPos, yPos, hudScaleX, hudScaleY, shieldStr); + hud_drawStringGpu(s_hudShieldFont, xPos, yPos, hudScaleX >> hudDoubled, hudScaleY >> hudDoubled, shieldStr); } // Health { @@ -614,7 +619,7 @@ namespace TFE_DarkForces sprintf(healthStr, "%03d", health); fixed16_16 xPos = mul16(intToFixed16(33), hudScaleX) + x1; fixed16_16 yPos = mul16(intToFixed16(26), hudScaleY) + y1; - hud_drawStringGpu(s_hudHealthFont, xPos, yPos, hudScaleX, hudScaleY, healthStr); + hud_drawStringGpu(s_hudHealthFont, xPos, yPos, hudScaleX >> hudDoubled, hudScaleY >> hudDoubled, healthStr); s_leftHudShow = 4; } @@ -659,13 +664,13 @@ namespace TFE_DarkForces } fixed16_16 xPos = mul16(intToFixed16(12), hudScaleX) + x0; fixed16_16 yPos = mul16(intToFixed16(21), hudScaleY) + y0; - hud_drawStringGpu(s_superChargeHud ? s_hudSuperAmmoFont : s_hudMainAmmoFont, xPos, yPos, hudScaleX, hudScaleY, str); + hud_drawStringGpu(s_superChargeHud ? s_hudSuperAmmoFont : s_hudMainAmmoFont, xPos, yPos, hudScaleX >> hudDoubled, hudScaleY >> hudDoubled, str); // Draw a colored quad to hide single-pixel "leaking" from beneath. xPos = mul16(intToFixed16(25), hudScaleX) + x0; yPos = mul16(intToFixed16(12), hudScaleY) + y0; - fixed16_16 quadWidth = mul16(intToFixed16(11), hudScaleX); - fixed16_16 quadHeight = mul16(intToFixed16(7), hudScaleY); + fixed16_16 quadWidth = mul16(intToFixed16(11), hudScaleX >> hudDoubled); + fixed16_16 quadHeight = mul16(intToFixed16(7), hudScaleY >> hudDoubled); screenGPU_drawColoredQuad(xPos, yPos, xPos + quadWidth, yPos + quadHeight, 0); @@ -677,7 +682,7 @@ namespace TFE_DarkForces { sprintf(str, "%02d", ammo1); } - hud_drawStringGpu(s_hudShieldFont, xPos, yPos, hudScaleX, hudScaleY, str); + hud_drawStringGpu(s_hudShieldFont, xPos, yPos, hudScaleX >> hudDoubled, hudScaleY >> hudDoubled, str); s_rightHudShow = 4; } @@ -762,6 +767,9 @@ namespace TFE_DarkForces // Go ahead and just update the HUD every frame, there are already checks to see if each item changed. //if (s_leftHudShow || s_rightHudShow) { + u16 hudWidth = s_hudStatusL->width; // should be 76(dos) or 76*2 = 152(mac) + u16 hudDoubled = hudWidth == 76 ? 0 : 1; + fixed16_16 batteryPower = TFE_Jedi::abs(s_batteryPower * 100); s32 percent = round16(batteryPower >> 1); if (s_prevBatteryPower != percent) // True when energy ticks down. @@ -792,7 +800,7 @@ namespace TFE_DarkForces char lifeCountStr[8]; sprintf(lifeCountStr, "%1d", lifeCount); - hud_drawString(s_cachedHudLeft, s_hudHealthFont, 52, 26, lifeCountStr); + hud_drawString(s_cachedHudLeft, s_hudHealthFont, 52 << hudDoubled, 26 << hudDoubled, lifeCountStr); s_rightHudShow = 4; } @@ -801,11 +809,11 @@ namespace TFE_DarkForces s_prevHeadlampActive = s_headlampActive; if (s_headlampActive) { - offscreenBuffer_drawTexture(s_cachedHudRight, s_hudLightOn, 19, 0); + offscreenBuffer_drawTexture(s_cachedHudRight, s_hudLightOn, 19 << hudDoubled, 0); } else { - offscreenBuffer_drawTexture(s_cachedHudRight, s_hudLightOff, 19, 0); + offscreenBuffer_drawTexture(s_cachedHudRight, s_hudLightOff, 19 << hudDoubled, 0); } s_rightHudShow = 4; } @@ -858,7 +866,7 @@ namespace TFE_DarkForces sprintf(shieldStr, "%03d", shields); } s_prevShields = shields; - hud_drawString(s_cachedHudLeft, s_hudShieldFont, 15, 26, shieldStr); + hud_drawString(s_cachedHudLeft, s_hudShieldFont, 15 << hudDoubled, 26 << hudDoubled, shieldStr); } s32 health = s_playerInfo.health; @@ -876,7 +884,7 @@ namespace TFE_DarkForces char healthStr[32]; sprintf(healthStr, "%03d", health); - hud_drawString(s_cachedHudLeft, s_hudHealthFont, 33, 26, healthStr); + hud_drawString(s_cachedHudLeft, s_hudHealthFont, 33 << hudDoubled, 26 << hudDoubled, healthStr); s_leftHudShow = 4; } @@ -919,7 +927,7 @@ namespace TFE_DarkForces { sprintf(str, "%03d", ammo0); } - hud_drawString(s_cachedHudRight, s_superChargeHud ? s_hudSuperAmmoFont : s_hudMainAmmoFont, 12, 21, str); + hud_drawString(s_cachedHudRight, s_superChargeHud ? s_hudSuperAmmoFont : s_hudMainAmmoFont, 12 << hudDoubled, 21 << hudDoubled, str); if (ammo1 < 0) { @@ -929,7 +937,7 @@ namespace TFE_DarkForces { sprintf(str, "%02d", ammo1); } - hud_drawString(s_cachedHudRight, s_hudShieldFont, 25, 12, str); + hud_drawString(s_cachedHudRight, s_hudShieldFont, 25 << hudDoubled, 12 << hudDoubled, str); s_rightHudShow = 4; s_prevPrimaryAmmo = ammo0; @@ -976,9 +984,11 @@ namespace TFE_DarkForces vfb_getResolution(&dispWidth, &dispHeight); if (dispWidth == 320 && dispHeight == 200) { + u16 hudHeight = s_hudStatusL->height; // should be 40(dos) or 80(mac) + u16 hudOffset = hudHeight - 40; // The original 320x200 code. - hud_drawElementToScreen(s_cachedHudRight, screenRect, 260, c_hudVertAnimTable[s_rightHudVertAnim], framebuffer); - hud_drawElementToScreen(s_cachedHudLeft, screenRect, 0, c_hudVertAnimTable[s_leftHudVertAnim], framebuffer); + hud_drawElementToScreen(s_cachedHudRight, screenRect, 320-s_cachedHudRight->width, c_hudVertAnimTable[s_rightHudVertAnim] - hudOffset, framebuffer); + hud_drawElementToScreen(s_cachedHudLeft, screenRect, 0, c_hudVertAnimTable[s_leftHudVertAnim] - hudOffset, framebuffer); } else { diff --git a/TheForceEngine/TFE_DarkForces/mission.cpp b/TheForceEngine/TFE_DarkForces/mission.cpp index 1a1186f1c..84158516a 100644 --- a/TheForceEngine/TFE_DarkForces/mission.cpp +++ b/TheForceEngine/TFE_DarkForces/mission.cpp @@ -203,7 +203,7 @@ namespace TFE_DarkForces void mission_createDisplay() { - vfb_setResolution(320, 200); + vfb_setResolution(s_loadScreen->width, s_loadScreen->height); s_framebuffer = vfb_getCpuBuffer(); } diff --git a/TheForceEngine/TFE_Jedi/Renderer/virtualFramebuffer.cpp b/TheForceEngine/TFE_Jedi/Renderer/virtualFramebuffer.cpp index 0e2ba6a7b..4ffbfad80 100644 --- a/TheForceEngine/TFE_Jedi/Renderer/virtualFramebuffer.cpp +++ b/TheForceEngine/TFE_Jedi/Renderer/virtualFramebuffer.cpp @@ -251,7 +251,7 @@ namespace TFE_Jedi { vdispFlags |= VDISP_GPU_COLOR_CONVERT; } - if (graphics->widescreen && (width != 320 || height != 200)) + if (graphics->widescreen && (width != 320 || height != 200) && (width != 640 || height != 480)) { vdispFlags |= VDISP_WIDESCREEN; }