Skip to content

Commit

Permalink
DM: Add warning with repeat parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Bendegúz Nagy committed Aug 26, 2016
1 parent 1f73323 commit 14bef53
Show file tree
Hide file tree
Showing 12 changed files with 120 additions and 100 deletions.
12 changes: 6 additions & 6 deletions engines/dm/champion.cpp
Expand Up @@ -157,7 +157,7 @@ bool ChampionMan::f328_isObjectThrown(uint16 champIndex, int16 slotIndex, int16
return false;
}
}
warning("MISSING CODE: F0064_SOUND_RequestPlay_CPSD");
warning(false, "MISSING CODE: F0064_SOUND_RequestPlay_CPSD");
f325_decrementStamine(champIndex, f305_getThrowingStaminaCost(L0996_T_Thing));
f330_disableAction(champIndex, 4);
AL0994_i_Experience = 8;
Expand Down Expand Up @@ -887,7 +887,7 @@ void ChampionMan::f304_addSkillExperience(uint16 champIndex, uint16 skillIndex,
int16 L0922_i_BaseSkillLevel;


warning("potaneitally dangerous cast of uint32 below");
warning(false, "potaneitally dangerous cast of uint32 below");
if ((skillIndex >= k4_ChampionSkillSwing) && (skillIndex <= k11_ChampionSkillShoot) && ((uint32)_vm->_projexpl->_g361_lastCreatureAttackTime < (_vm->_g313_gameTime - 150))) {
exp >>= 1;
}
Expand All @@ -902,7 +902,7 @@ void ChampionMan::f304_addSkillExperience(uint16 champIndex, uint16 skillIndex,
L0916_ui_BaseSkillIndex = skillIndex;
}
AL0915_ui_SkillLevelBefore = f303_getSkillLevel(champIndex, L0916_ui_BaseSkillIndex | (k0x4000_IgnoreObjectModifiers | k0x8000_IgnoreTemporaryExperience));
warning("potentially dangerous cast of uint32 below");
warning(false, "potentially dangerous cast of uint32 below");
if ((skillIndex >= k4_ChampionSkillSwing) && ((uint32)_vm->_projexpl->_g361_lastCreatureAttackTime > (_vm->_g313_gameTime - 25))) {
exp <<= 1;
}
Expand Down Expand Up @@ -1145,7 +1145,7 @@ ChampionIndex ChampionMan::f285_getIndexInCell(int16 cell) {

void ChampionMan::f278_resetDataToStartGame() {
if (!_vm->_g298_newGame) {
warning("MISSING CODE: stuff for resetting for loaded games");
warning(false, "MISSING CODE: stuff for resetting for loaded games");
assert(false);
}

Expand Down Expand Up @@ -1401,7 +1401,7 @@ uint16 ChampionMan::f306_getStaminaAdjustedValue(Champion *champ, int16 val) {
int16 currStamina = champ->_currStamina;
int16 halfMaxStamina = champ->_maxStamina / 2;
if (currStamina < halfMaxStamina) {
warning("Possible undefined behavior in the original code");
warning(false, "Possible undefined behavior in the original code");
val /= 2;
return val + ((uint32)val * (uint32)currStamina) / halfMaxStamina;
}
Expand Down Expand Up @@ -1693,7 +1693,7 @@ void ChampionMan::f291_drawSlot(uint16 champIndex, int16 slotIndex) {
}

void ChampionMan::f281_renameChampion(Champion* champ) {
warning("STUB METHOD: Champion::renameChampion, F0281_CHAMPION_Rename");
warning(false, "STUB METHOD: Champion::renameChampion, F0281_CHAMPION_Rename");

DisplayMan &dispMan = *_vm->_displayMan;
TextMan &textMan = *_vm->_textMan;
Expand Down
40 changes: 30 additions & 10 deletions engines/dm/dm.cpp
Expand Up @@ -37,6 +37,8 @@
#include "graphics/palette.h"
#include "common/file.h"
#include "common/events.h"
#include "common/array.h"
#include "common/algorithm.h"

#include "dm/dm.h"
#include "gfx.h"
Expand All @@ -54,6 +56,24 @@
#include "projexpl.h"

namespace DM {
void warning(bool repeat, const char* s, ...) {
va_list va;

va_start(va, s);
Common::String output = Common::String::vformat(s, va);
va_end(va);

if (repeat) {
::warning(output.c_str());
} else {
static Common::Array<Common::String> stringsPrinted;

if (Common::find(stringsPrinted.begin(), stringsPrinted.end(), s) == stringsPrinted.end()) {
stringsPrinted.push_back(output);
::warning(output.c_str());
}
}
}

void turnDirRight(direction &dir) { dir = (direction)((dir + 1) & 3); }
void turnDirLeft(direction &dir) { dir = (direction)((dir - 1) & 3); }
Expand Down Expand Up @@ -151,7 +171,7 @@ DMEngine::DMEngine(OSystem *syst) : Engine(syst), _console(nullptr) {
debug("DMEngine::DMEngine");


warning("DUMMY CODE: setting _g298_newGame to true, should be in processEntrance");
warning(false, "DUMMY CODE: setting _g298_newGame to true, should be in processEntrance");
_g298_newGame = true;
}

Expand Down Expand Up @@ -200,7 +220,7 @@ void DMEngine::f463_initializeGame() {
_eventMan->initMouse();
//F0441_STARTEND_ProcessEntrance();
while (_loadsaveMan->f435_loadgame() != k1_LoadgameSuccess) {
warning("TODO: F0441_STARTEND_ProcessEntrance");
warning(false, "TODO: F0441_STARTEND_ProcessEntrance");
}
//F0396_MENUS_LoadSpellAreaLinesBitmap() is not needed, every bitmap has been loaded

Expand All @@ -216,7 +236,7 @@ void DMEngine::f463_initializeGame() {
}

void DMEngine::f448_initMemoryManager() {
warning("STUB FUNCTION");
warning(false, "STUB FUNCTION");
for (uint16 i = 0; i < 16; ++i)
_displayMan->_g347_paletteTopAndBottomScreen[i] = g21_PalDungeonView[0][i];
}
Expand Down Expand Up @@ -246,7 +266,7 @@ void DMEngine::f462_startGame() {
f3_processNewPartyMap(_dungeonMan->_g309_partyMapIndex);

if (!_g298_newGame) {
warning("TODO: loading game");
warning(false, "TODO: loading game");
assert(false);
} else {
_displayMan->_g578_useByteBoxCoordinates = false;
Expand All @@ -255,7 +275,7 @@ void DMEngine::f462_startGame() {
_displayMan->D24_fillScreenBox(g63_boxScreenBottom, k0_ColorBlack);
}

warning("TODO: build copper");
warning(false, "TODO: build copper");
_menuMan->f395_drawMovementArrows();
_championMan->f278_resetDataToStartGame();
_g301_gameTimeTicking = true;
Expand Down Expand Up @@ -293,20 +313,20 @@ Common::Error DMEngine::run() {
f463_initializeGame(); // @ F0463_START_InitializeGame_CPSADEF
while (true) {
f2_gameloop();
warning("TODO: F0444_STARTEND_Endgame(G0303_B_PartyDead);");
warning(false, "TODO: F0444_STARTEND_Endgame(G0303_B_PartyDead);");
}

return Common::kNoError;
}

void DMEngine::f2_gameloop() {
warning("DUMMY CODE SETTING PARTY POS AND DIRECTION");
warning(false, "DUMMY CODE SETTING PARTY POS AND DIRECTION");
_dungeonMan->_g306_partyMapX = 10;
_dungeonMan->_g307_partyMapY = 4;
_dungeonMan->_g308_partyDir = kDirNorth;
warning("DUMMY CODE: setting InventoryMan::_g432_inventoryChampionOrdinal to zero");
warning(false, "DUMMY CODE: setting InventoryMan::_g432_inventoryChampionOrdinal to zero");
_inventoryMan->_g432_inventoryChampionOrdinal = 0;
warning("DUMMY CODE: clearing screen to black"); // in loop below
warning(false, "DUMMY CODE: clearing screen to black"); // in loop below

while (true) {
if (_g327_newPartyMapIndex != kM1_mapIndexNone) {
Expand All @@ -331,7 +351,7 @@ void DMEngine::f2_gameloop() {
_eventMan->f78_showMouse();
_eventMan->f68_setPointerToObject(_objectMan->_g412_objectIconForMousePointer);
_eventMan->f77_hideMouse();

}
if (_eventMan->_g326_refreshMousePointerInMainLoop) {
_eventMan->_g326_refreshMousePointerInMainLoop = false;
Expand Down
2 changes: 1 addition & 1 deletion engines/dm/dm.h
Expand Up @@ -50,7 +50,7 @@ class GroupMan;
class Timeline;
class ProjExpl;


void warning(bool repeat, const char *s, ...);

enum direction {
kDirNorth = 0,
Expand Down
2 changes: 1 addition & 1 deletion engines/dm/dungeonman.cpp
Expand Up @@ -475,7 +475,7 @@ void DungeonMan::f455_decompressDungeonFile() {
}
}
} else {
warning("TODO: if the dungeon is uncompressed, read it here");
warning(false, "TODO: if the dungeon is uncompressed, read it here");
}
f.close();
}
Expand Down
6 changes: 3 additions & 3 deletions engines/dm/eventman.cpp
Expand Up @@ -412,7 +412,7 @@ void EventManager::f68_setPointerToObject(byte* bitmap) {
_vm->_displayMan->f129_blitToBitmapShrinkWithPalChange(bitmap, _gK190_mousePointerTempBuffer, 16, 16, 16, 16, g44_palChangesMousePointerIcon);
_vm->_displayMan->f132_blitToBitmap(_gK190_mousePointerTempBuffer, L0051_puc_Bitmap, g620_BoxMousePointerObject, 0, 0, 8, 16, k0_ColorBlack, 16, 18);
*/
warning("TODO - Call f129_blitToBitmapShrinkWithPalChange");
warning(false, "TODO - Call f129_blitToBitmapShrinkWithPalChange");
// dummy code
_vm->_displayMan->f132_blitToBitmap(bitmap, L0051_puc_Bitmap, g619_BoxMousePointerObjectShadow, 0, 0, 8, 16, kM1_ColorNoTransparency, 16, 18);
_vm->_displayMan->f132_blitToBitmap(bitmap, L0051_puc_Bitmap, g620_BoxMousePointerObject, 0, 0, 8, 16, k0_ColorBlack, 16, 18);
Expand Down Expand Up @@ -797,7 +797,7 @@ void EventManager::f377_commandProcessType80ClickInDungeonView(int16 posX, int16
L1151_ps_Junk = (Junk*)_vm->_dungeonMan->f157_getSquareFirstThingData(L1155_i_MapX, L1156_i_MapY);
if ((((Door*)L1151_ps_Junk)->hasButton()) && _vm->_dungeonMan->_g291_dungeonViewClickableBoxes[k5_ViewCellDoorButtonOrWallOrn].isPointInside(posX, posY - 33)) {
_vm->_g321_stopWaitingForPlayerInput = true;
warning("MISSING CODE: F0064_SOUND_RequestPlay_CPSD");
warning(false, "MISSING CODE: F0064_SOUND_RequestPlay_CPSD");
_vm->_movsens->f268_addEvent(k10_TMEventTypeDoor, L1155_i_MapX, L1156_i_MapY, 0, k2_SensorEffToggle, _vm->_g313_gameTime + 1);
return;
}
Expand Down Expand Up @@ -954,7 +954,7 @@ void EventManager::f378_commandProcess81ClickInPanel(int16 x, int16 y) {
return;
commandType = f358_getCommandTypeFromMouseInput(g456_MouseInput_PanelChest, Common::Point(x, y), k1_LeftMouseButton);
if (commandType != k0_CommandNone)
warning("MISSING CODE: F0302_CHAMPION_ProcessCommands28To65_ClickOnSlotBox");
warning(false, "MISSING CODE: F0302_CHAMPION_ProcessCommands28To65_ClickOnSlotBox");
break;
case k5_PanelContentResurrectReincarnate:
if (!champMan._g415_leaderEmptyHanded)
Expand Down
34 changes: 17 additions & 17 deletions engines/dm/gfx.cpp
Expand Up @@ -703,7 +703,7 @@ DisplayMan::DisplayMan(DMEngine *dmEngine) : _vm(dmEngine) {
_g99_bitmapWall_D0R_Native = nullptr;

_g322_paletteSwitchingEnabled = false;
warning("DUMMY CODE: setting _g304_dungeonViewPaletteIndex");
warning(false, "DUMMY CODE: setting _g304_dungeonViewPaletteIndex");
_g304_dungeonViewPaletteIndex = 0;

g186_doorFrame_D1C = new DoorFrames( // @ G0186_s_Graphic558_Frames_Door_D1C
Expand Down Expand Up @@ -815,8 +815,8 @@ void DisplayMan::f460_initializeGraphicData() {
_g709_bitmapWallSet_DoorFrameFront = new byte[32 * 123];
_g296_bitmapViewport = new byte[224 * 136];

warning("SKIPPED CODE: G0086_puc_Bitmap_ViewportBlackArea it is useless");
warning("SKIPPED CODE: G0087_puc_Bitmap_ViewportFloorArea it is useless");
warning(false, "SKIPPED CODE: G0086_puc_Bitmap_ViewportBlackArea it is useless");
warning(false, "SKIPPED CODE: G0087_puc_Bitmap_ViewportFloorArea it is useless");

if (!_g639_derivedBitmapByteCount)
_g639_derivedBitmapByteCount = new uint16[k730_DerivedBitmapMaximumCount];
Expand Down Expand Up @@ -1050,7 +1050,7 @@ void DisplayMan::f565_viewportSetPalette(uint16* middleScreenPalette, uint16* to
}

void DisplayMan::f566_viewportBlitToScreen() {
warning("MISSING FUNCTIONALITY: using correct colorpalette");
warning(false, "MISSING FUNCTIONALITY: using correct colorpalette");
Box box(0, 223, 33, 33 + 135);

f132_blitToBitmap(_g296_bitmapViewport, _g348_bitmapScreen, box, 0, 0, k112_byteWidthViewport, k160_byteWidthScreen, kM1_ColorNoTransparency);
Expand Down Expand Up @@ -1144,7 +1144,7 @@ void DisplayMan::f133_blitBoxFilledWithMaskedBitmap(byte* src, byte* dest, byte*
int16 lastUnitIndex, int16 firstUnitIndex, int16 destByteWidth, Color transparent,
int16 xPos, int16 yPos, int16 destHeight, int16 height2) {
// make sure to take care of inclusive boundaries
warning("STUB FUNCTION: does nothing at all");
warning(false, "STUB FUNCTION: does nothing at all");
}


Expand Down Expand Up @@ -2045,7 +2045,7 @@ void DisplayMan::f124_drawSquareD1C(direction dir, int16 posX, int16 posY) {
_g296_bitmapViewport, g106_BoxThievesEye_ViewPortVisibleArea, 0, 0,
48, k112_byteWidthViewport, k9_ColorGold, 95, k136_heightViewport); /* BUG0_74 */
f493_addDerivedBitmap(k1_DerivedBitmapThievesEyeVisibleArea);
warning("MISSING CODE: F0480_CACHE_ReleaseBlock");
warning(false, "MISSING CODE: F0480_CACHE_ReleaseBlock");
}
return;
case k17_DoorFrontElemType:
Expand Down Expand Up @@ -2265,7 +2265,7 @@ void DisplayMan::f128_drawDungeon(direction dir, int16 posX, int16 posY) {
}

void DisplayMan::f98_drawFloorAndCeiling() {
warning("f98_drawFloorAndCeiling doesn't do anything");
warning(false, "f98_drawFloorAndCeiling doesn't do anything");
_g297_drawFloorAndCeilingRequested = false;
}

Expand Down Expand Up @@ -2711,9 +2711,9 @@ void DisplayMan::f113_drawField(FieldAspect* fieldAspect, Box& box) {
}

// byte *bitmap = dispMan.f489_getNativeBitmapOrGraphic(k73_FieldTeleporterGraphicIndice + fieldAspect->_nativeBitmapRelativeIndex);
warning("MISSING CODE: F0133_VIDEO_BlitBoxFilledWithMaskedBitmap");
warning(false, "MISSING CODE: F0133_VIDEO_BlitBoxFilledWithMaskedBitmap");

warning("IGNORED CODE: F0491_CACHE_IsDerivedBitmapInCache, F0493_CACHE_AddDerivedBitmap, F0480_CACHE_ReleaseBlock");
warning(false, "IGNORED CODE: F0491_CACHE_IsDerivedBitmapInCache, F0493_CACHE_AddDerivedBitmap, F0480_CACHE_ReleaseBlock");
}

int16 DisplayMan::f459_getScaledBitmapByteCount(int16 byteWidth, int16 height, int16 scale) {
Expand Down Expand Up @@ -3109,7 +3109,7 @@ creatures are drawn in the right order and so that Fluxcages are not drawn twice
if (flipHorizontal) {
f130_flipBitmapHorizontal(AL_6_bitmapRedBanana, M77_getNormalizedByteWidth(byteWidth), heightRedEagle);
}
warning("IGNORED CODE: F0493_CACHE_AddDerivedBitmap");
warning(false, "IGNORED CODE: F0493_CACHE_AddDerivedBitmap");
}
}
AL_4_xPos = coordinateSet[0];
Expand Down Expand Up @@ -3341,7 +3341,7 @@ creatures are drawn in the right order and so that Fluxcages are not drawn twice
memmove(AL_6_bitmapRedBanana, bitmapGreenAnt, byteWidth * 2 * heightRedEagle * sizeof(byte));
f130_flipBitmapHorizontal(AL_6_bitmapRedBanana, byteWidth, heightRedEagle);
}
warning("IGNORED CODE: F0493_CACHE_AddDerivedBitmap");
warning(false, "IGNORED CODE: F0493_CACHE_AddDerivedBitmap");
}
}
}
Expand Down Expand Up @@ -3371,7 +3371,7 @@ creatures are drawn in the right order and so that Fluxcages are not drawn twice
bitmapGreenAnt = f489_getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex);
AL_6_bitmapRedBanana = f492_getDerivedBitmap(derivedBitmapIndex);
f129_blitToBitmapShrinkWithPalChange(bitmapGreenAnt, AL_6_bitmapRedBanana, sourceByteWidth * 2, sourceHeight, byteWidth * 2, heightRedEagle, paletteChanges);
warning("IGNORED CODE: F0493_CACHE_AddDerivedBitmap");
warning(false, "IGNORED CODE: F0493_CACHE_AddDerivedBitmap");
}
if ((useCreatureSideBitmap && (creatureDirectionDelta == 1)) || /* If creature is viewed from the right, the side view must be flipped */
(useCreatureAttackBitmap && getFlag(creatureAspectInt, k0x0040_MaskActiveGroupFlipBitmap)) ||
Expand Down Expand Up @@ -3513,7 +3513,7 @@ continue;
f129_blitToBitmapShrinkWithPalChange(bitmapGreenAnt, AL_6_bitmapRedBanana, ((ProjectileAspect *)objectAspect)->_byteWidth * 2, ((ProjectileAspect *)objectAspect)->_height,
byteWidth * 2, heightRedEagle, _g75_palChangesProjectile[AL_8_projectileScaleIndex >> 1]);
if (doNotScaleWithKineticEnergy) {
warning("IGNORED CODE F0493_CACHE_AddDerivedBitmap");
warning(false, "IGNORED CODE F0493_CACHE_AddDerivedBitmap");
}
}
}
Expand Down Expand Up @@ -3627,7 +3627,7 @@ T0115171_BackFromT0115015_DrawProjectileAsObject:;
AL_4_explosionAspectIndex++; /* Use third graphic in the pattern for large explosion attack */
}
}
warning("IGNORED CODE: F0491_CACHE_IsDerivedBitmapInCache");
warning(false, "IGNORED CODE: F0491_CACHE_IsDerivedBitmapInCache");
AL_6_bitmapRedBanana = f489_getNativeBitmapOrGraphic(AL_4_explosionAspectIndex + k351_FirstExplosionPatternGraphicIndice);
if (smoke) {
f129_blitToBitmapShrinkWithPalChange(AL_6_bitmapRedBanana, _g74_tmpBitmap, 48, 32, 48, 32, g212_PalChangeSmoke);
Expand All @@ -3636,8 +3636,8 @@ T0115171_BackFromT0115015_DrawProjectileAsObject:;
f133_blitBoxFilledWithMaskedBitmap(AL_6_bitmapRedBanana, _g296_bitmapViewport, nullptr, f492_getDerivedBitmap(k0_DerivedBitmapViewport), g105_BoxExplosionPattern_D0C,
_vm->_rnd->getRandomNumber(4) + 87, _vm->_rnd->getRandomNumber(64),
224, (Color)(k0x0080_BlitDoNotUseMask | k10_ColorFlesh), 0, 0, 136, 93);
warning("IGNORED CODE: F0493_CACHE_AddDerivedBitmap");
warning("IGNORED CODE: F0493_CACHE_AddDerivedBitmap");
warning(false, "IGNORED CODE: F0493_CACHE_AddDerivedBitmap");
warning(false, "IGNORED CODE: F0493_CACHE_AddDerivedBitmap");
} else {
if (rebirthExplosion) {
explosionCoordinates = g227_RebirthStep2ExplosionCoordinates[AL_1_viewSquareExplosionIndex - 3];
Expand Down Expand Up @@ -3736,7 +3736,7 @@ byte* DisplayMan::f492_getDerivedBitmap(int16 derivedBitmapIndex) {
}

void DisplayMan::f493_addDerivedBitmap(int16 derivedBitmapIndex) {
warning("f493_addDerivedBitmap DOES NOTHING");
warning(false, "f493_addDerivedBitmap DOES NOTHING");
}

}

0 comments on commit 14bef53

Please sign in to comment.