Skip to content

Commit c46656d

Browse files
committed
diablo: add more logs to print to stdout
Mostly events like pause, load, save, etc. Will be collected by the AI worker. Signed-off-by: Roman Penyaev <[email protected]>
1 parent bd1ed28 commit c46656d

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

Source/diablo.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ void PressKey(SDL_Keycode vkey, uint16_t modState)
487487
return;
488488

489489
if (gmenu_presskeys(vkey) || CheckKeypress(vkey)) {
490+
printf(">> %s:%d, not handled\n", __func__, __LINE__);
490491
return;
491492
}
492493

@@ -849,6 +850,8 @@ void RunGameLoop(interface_mode uMsg)
849850
gbProcessPlayers = IsDiabloAlive(true);
850851
gbRunGameResult = true;
851852

853+
printf(">> %s\n", __func__);
854+
852855
RedrawEverything();
853856
if (!HeadlessMode) {
854857
while (IsRedrawEverything()) {
@@ -2536,6 +2539,9 @@ bool StartGame(bool bNewGame, bool bSinglePlayer)
25362539
gbSelectProvider = true;
25372540
ReturnToMainMenu = false;
25382541

2542+
printf(">> %s: newgame=%d, single=%d\n", __func__,
2543+
bNewGame, bSinglePlayer);
2544+
25392545
do {
25402546
gbLoadGame = false;
25412547

@@ -2760,8 +2766,10 @@ void diablo_pause_game()
27602766
if (!gbIsMultiplayer) {
27612767
if (PauseMode != 0) {
27622768
PauseMode = 0;
2769+
printf(">> %s: resumed\n", __func__);
27632770
} else {
27642771
PauseMode = 2;
2772+
printf(">> %s: paused\n", __func__);
27652773
sound_stop();
27662774
qtextflag = false;
27672775
LastMouseButtonAction = MouseActionType::None;
@@ -3367,12 +3375,21 @@ inject_sdl_events(uint32_t new_type)
33673375
} else if (bit == RING_ENTRY_KEY_SAVE) {
33683376
sdl_sym = SDLK_F2;
33693377
sdl_scan = SDL_SCANCODE_F2;
3378+
3379+
if (sdl_type == SDL_KEYDOWN)
3380+
printf(">> %s: received SAVE\n", __func__);
33703381
} else if (bit == RING_ENTRY_KEY_LOAD) {
33713382
sdl_sym = SDLK_F3;
33723383
sdl_scan = SDL_SCANCODE_F3;
3384+
3385+
if (sdl_type == SDL_KEYDOWN)
3386+
printf(">> %s: received LOAD\n", __func__);
33733387
} else if (bit == RING_ENTRY_KEY_PAUSE) {
33743388
sdl_sym = SDLK_PAUSE;
33753389
sdl_scan = SDL_SCANCODE_PAUSE;
3390+
3391+
if (sdl_type == SDL_KEYDOWN)
3392+
printf(">> %s: received PAUSE\n", __func__);
33763393
} else {
33773394
/* Unknown key */
33783395
continue;

Source/gamemenu.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,11 @@ void gamemenu_quit_game(bool bActivate)
292292

293293
void gamemenu_load_game(bool /*bActivate*/)
294294
{
295+
printf(">> %s:%d\n", __func__, __LINE__);
296+
295297
EventHandler newHandler = { DisableInputEventHandler, SDL_PollEvent };
296298
EventHandler prevHandler = SetEventHandler(newHandler);
299+
297300
gamemenu_off();
298301
ClearFloatingNumbers();
299302
NewCursor(CURSOR_NONE);
@@ -329,6 +332,8 @@ void gamemenu_load_game(bool /*bActivate*/)
329332

330333
void gamemenu_save_game(bool /*bActivate*/)
331334
{
335+
printf(">> %s:%d\n", __func__, __LINE__);
336+
332337
if (pcurs != CURSOR_HAND) {
333338
return;
334339
}

Source/interfac.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ void DoLoad(interface_mode uMsg)
289289
currlevel = myPlayer.plrlevel;
290290
leveltype = GetLevelType(currlevel);
291291
IncProgress();
292+
//XXX
292293
loadResult = LoadGameLevel(false, ENTRY_MAIN);
293294
if (loadResult.has_value()) IncProgress();
294295
break;

Source/multi.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,8 @@ bool InitSingle(GameData *gameData)
455455
{
456456
Players.resize(1);
457457

458+
printf(">> %s:%d\n", __func__, __LINE__);
459+
458460
if (!SNetInitializeProvider(SELCONN_LOOPBACK, gameData)) {
459461
return false;
460462
}
@@ -504,6 +506,8 @@ bool InitMulti(GameData *gameData)
504506

505507
pfile_read_player_from_save(gSaveNumber, *MyPlayer);
506508

509+
printf(">> %s:%d\n", __func__, __LINE__);
510+
507511
return true;
508512
}
509513

0 commit comments

Comments
 (0)