Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ddda6ef
Add throwing potions to Rogomatic 1.48
mikeyk730 Sep 3, 2025
1c7f9e2
strat overhaul
mikeyk730 Sep 4, 2025
7a353ff
fix bug with searching
mikeyk730 Sep 4, 2025
f6c6279
amulet 1.48
mikeyk730 Sep 4, 2025
09da769
Restrict drain life when it could cause us to die in 1 turn
mikeyk730 Sep 5, 2025
faa870f
fix attempt logic so we look under monsters for stairs
mikeyk730 Sep 5, 2025
3b57a5b
Fix more loops with trying to drop on an occupied space
mikeyk730 Sep 5, 2025
636a186
improve teleportation handling
mikeyk730 Sep 5, 2025
452f170
Add room to debug screen
mikeyk730 Sep 5, 2025
5811b86
document pc maze behavior
mikeyk730 Sep 6, 2025
7479e27
document bugfix
mikeyk730 Sep 6, 2025
e1b2f3b
fix short term memory bug
mikeyk730 Sep 6, 2025
7f57f38
more debug logs
mikeyk730 Sep 6, 2025
bdc77e3
fall into trap is not teleport
mikeyk730 Sep 6, 2025
8c4c749
aggressive plunge, rest before wake hold
mikeyk730 Sep 7, 2025
fa3ef13
fix ring of see invis
mikeyk730 Sep 7, 2025
98ed21f
allow pc rogomatic to handle phantoms
mikeyk730 Sep 7, 2025
a9eb14f
gene lock issue
mikeyk730 Sep 7, 2025
bd5012e
Fix args. Support --debug-at-level
mikeyk730 Sep 7, 2025
e604ddc
same rogomatic log for all cases
mikeyk730 Sep 7, 2025
24459c0
document bug where msg gets corrupt
mikeyk730 Sep 7, 2025
9047860
hack for msg bug
mikeyk730 Sep 7, 2025
65b91f3
Detect and flag maze rooms
mikeyk730 Sep 9, 2025
6b60e78
Better maze detection
mikeyk730 Sep 9, 2025
660d031
Don't leave room to arch. Encourage resting in maze rooms
mikeyk730 Sep 9, 2025
67c7614
better handling for scare monster, and held monsters
mikeyk730 Sep 9, 2025
3fffbde
more agressive go up stairs
mikeyk730 Sep 9, 2025
f2b1d9c
safer drop junk, winning runs
mikeyk730 Sep 9, 2025
143ba11
telemetry for sleepers
mikeyk730 Sep 9, 2025
3a408cc
fix teleport trap connections and state
mikeyk730 Sep 10, 2025
9835a38
total winner with current code
mikeyk730 Sep 10, 2025
beef092
remeber room sleepers, and scare monster in passage
mikeyk730 Sep 10, 2025
ebc1569
remeber room sleepers, and scare monster in passage
mikeyk730 Sep 10, 2025
c141623
debug features
mikeyk730 Sep 11, 2025
c973800
cmd line
mikeyk730 Sep 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions rogue.opt
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ menu=true
;
room_bugfix=true

;
; This controls the behavior when the user types an invalid command, i.e. ';'.
; If true, monsters can wake up after the invalid command. If false, monsters
; can only wake up after a valid command. This was added to not penalize
; Rogomatic, which uses ';' for synchronization.
;
illegal_commands_wake_monsters=false

;
; If set to true, the experience level name (e.g Warrior) is shown. If set to
; false, the numeric value is shown.
Expand Down Expand Up @@ -273,6 +281,13 @@ rogomatic_delay=0
;
rogomatic_level_delay=0

;
; If Rogomatic reaches this level, it will pause in the in-game debugger
;
; Possible values: Any non-negative integer, e.g. 26
;
rogomatic_pause_at_level=

;
; If set to true, a debug log will be written, and the in-game debugger will
; break on any fatal, error, or warning breakpoints.
Expand All @@ -281,6 +296,13 @@ rogomatic_level_delay=0
;
rogomatic_debug=false

;
; If set to verbose, more detailed information will be included in the debug log.
;
; Possible values: verbose
;
rogomatic_log_verbosity=

;
; If set to true, a file named ipc.txt will be used for communication from
; Rogue to Rogomatic, and a log of the token stream will be written. If set
Expand Down
56 changes: 46 additions & 10 deletions src/Rogomatic/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ int d;
}

/* Move 'count' squares in direction 'd', with time use mode 'mode' */
void rmove(desc, count, d, mode)
const char* desc;
int count, d, mode;
void rmove(const char* desc, int count, int d, int mode)
{
command (desc, mode, "%d%c", count, keydir[d]);
}
Expand Down Expand Up @@ -151,6 +149,8 @@ void command (const char* description, int tmode, char* f, ...)
default: movedir = NOTAMOVE;
}

debuglog("movedir %s\n", get_move_dir_str(movedir));

/* If command takes time to execute, mark monsters as sleeping */
/* If they move, wakemonsters will mark them as awake */
if (tmode != T_OTHER)
Expand All @@ -171,14 +171,15 @@ void command (const char* description, int tmode, char* f, ...)
if (previous/1000 != current/1000)
{
dosnapshot();
int severity = (current > 15000) ? D_FATAL : D_WARNING;
int severity = (current > 15000) ? D_FATAL : D_ERROR;
dwait(severity, "Excessive %s for %d turns on level %d", tmode_to_str(tmode), timespent[Level].activity[tmode], Level);
}

/* mdk:clear active item if we're doing something different than inventory */
if (cmd[0] != 'i' && cmd[0] != 'I')
{
clear_active_item();
is_exploring_passage = 0;
}

/* Do the inventory stuff */
Expand Down Expand Up @@ -206,19 +207,54 @@ char *cmd;
return (max (times, 1));
}

int is_dir_key(char c)
{
switch (c)
{
case 'y':
case 'u':
case 'h':
case 'j':
case 'k':
case 'l':
case 'n':
case 'm':
return 1;
}

return 0;
}

int is_command_only_dir_keys(const char* command)
{
for (const char* s = command; *s != 0; ++s)
{
if (!is_dir_key(*s))
return 0;
}

return 1;
}

/*
* functionchar: return the function character of a command.
*/

char
functionchar (cmd)
char *cmd;
char functionchar(const char* cmd)
{
register char *s = cmd;
if (is_command_only_dir_keys(cmd))
{
int len = strlen(cmd);
return cmd[len - 1];
}

while (ISDIGIT (*s) || *s == 'f') s++;
const char *s = cmd;

while (ISDIGIT(*s) || *s == 'f') s++;
if (can_move_without_pickup())
while (ISDIGIT(*s) || *s == 'm') s++;

return (*s);
return *s;
}

/*
Expand Down
4 changes: 2 additions & 2 deletions src/Rogomatic/database.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ char *codename;
char *name;
stuff item_type;
{
debuglog("infer: '%s' is '%s' (%s)\n", codename, name, get_item_type_string(item_type));
debuglog("infer: '%s' is '%s' (%s)\n", codename, name, get_item_type_str(item_type));

register int i;

Expand Down Expand Up @@ -223,7 +223,7 @@ char *codename;
if (streq (dbase[i].fakename, codename))
return (dbase[i].used);

dwait (D_PACK, "used: unknown codename '%s'", codename); /* mdk: added dwait */
//dwait (D_PACK, "used: unknown codename '%s'", codename); /* mdk: added dwait */
return 0;
}

Expand Down
32 changes: 17 additions & 15 deletions src/Rogomatic/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@ void print_command_line(FILE *errfil)
{
fprintf(
errfil,
"RogueCollection.exe %c --rogomatic --seed %d --genes \"%d %d %d %d %d %d %d %d %d\"\n\n",
"RogueCollection.exe %c --rogomatic --seed %d --genes \"%d %d %d %d %d %d %d %d %d\" --debug-at-level %d\n\n",
get_game_char(),
g_seed,
knob[0], knob[1], knob[2], knob[3], knob[4], knob[5], knob[6], knob[7],
g_bug_fixes);
g_bug_fixes,
Level);
}
#endif

Expand All @@ -81,7 +82,7 @@ int dwait (int msgtype, char* f, ...)
vsprintf (msg, f, args);
va_end(args);

debuglog("dwait: %s\n", msg);
debuglog("dwait: %s: %s\n", get_debug_str(msgtype), msg);

/* Log the message if the error is severe enough */
if (!replaying && (msgtype & (D_FATAL | D_ERROR | D_WARNING))) {
Expand All @@ -90,8 +91,8 @@ int dwait (int msgtype, char* f, ...)
sprintf (errfn, "%s/error%s", getRgmDir (), versionstr);

if ((errfil = wopen (errfn, "a")) != NULL) {
fprintf (errfil, "Level %d, error %d: %s\n\n",
Level, msgtype, msg);
fprintf (errfil, "%d Level %d, error %d: %s\n\n",
g_seed, Level, msgtype, msg);
#ifdef ROGUE_COLLECTION
print_command_line(errfil);
#endif
Expand Down Expand Up @@ -136,6 +137,9 @@ int dwait (int msgtype, char* f, ...)
say ("i=inv, d=debug !=stf, @=mon, #=wls, $=id, ^=flg, &=chr");
break;
case 'i': at (1,0); dumpinv ((FILE *) NULL); at (row, col); break;
case 'r':
redrawscreen();
break;
case 'd': toggledebug (); break;
case 't': transparent = 1; break;
case '!': dumpstuff (); break;
Expand All @@ -151,7 +155,11 @@ int dwait (int msgtype, char* f, ...)
case '(': dumpdatabase (); at (row, col); break;
case ')': new_mark++; markcycles (DOPRINT); at (row, col); break;
case '~': saynow ("Version %s, quit at %d", versionstr, quitat); break;
case '/': dosnapshot (); break;
case '/':
printscreen();
printscreenattrs();
printtimessearched();
break;
default: at (row, col); return (1);
}
}
Expand Down Expand Up @@ -241,20 +249,14 @@ void toggledebug ()
char debugstr[100];
int type = debugging & ~(D_FATAL | D_ERROR | D_WARNING);

if (debugging == D_ALL) debugging = D_NORMAL;
if (debugging == D_ALL) debugging = 0;
else if (debugging == 0) debugging = D_NORMAL;
else if (debugging == D_NORMAL) debugging = D_NORMAL | D_ITEM;
else if (type == D_ITEM) debugging = D_NORMAL | D_SCROLL;
else if (type == D_SCROLL) debugging = D_NORMAL | D_POTION;
else if (type == D_POTION) debugging = D_NORMAL | D_WAND;
else if (type == D_WAND) debugging = D_NORMAL | D_RING;
else if (type == D_RING) debugging = D_NORMAL | D_BATTLE;
else if (type == D_BATTLE) debugging = D_NORMAL | D_MESSAGE;
else if (type == D_MESSAGE) debugging = D_NORMAL | D_PACK;
else if (type == D_PACK) debugging = D_NORMAL | D_MONSTER;
else if (type == D_MONSTER) debugging = D_NORMAL | D_CONTROL;
else if (type == D_CONTROL) debugging = D_NORMAL | D_SCREEN;
else if (type == D_SCREEN) debugging = D_NORMAL | D_WARNING;
else if (!debug (D_INFORM)) debugging = D_NORMAL | D_WARNING | D_INFORM;
else if (type == D_RING) debugging = D_NORMAL | D_ALL;
else debugging = D_ALL;

strncpy (debugstr, "Debugging :", 100);
Expand Down
36 changes: 27 additions & 9 deletions src/Rogomatic/debuglog.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,38 @@ err_doit(int errnoflag, int error, const char *fmt, va_list ap)
}*/
}

void debuglog_open (const char *log)
void debuglog_open()
{
if (g_debug)
debug = fopen (log, "w");
if (!debug)
{
debug = fopen("debug-rogomatic.log", "w");
print_command_line(debug);
}
}

void debuglog_close()
{
if (debug)
fclose(debug);

debug = NULL;
}

void debuglog_close (void)
void toggledebuglog()
{
if (debug != NULL)
fclose (debug);
if (debug)
{
saynow("Closing debug log");
debuglog_close();
}
else
{
saynow("Opening debug log");
debuglog_open();
}
}


void debuglog (const char *fmt, ...)
{
va_list ap;
Expand All @@ -67,11 +87,9 @@ void debuglog (const char *fmt, ...)
va_end (ap);
}

int g_verbose = 0; //todo:mdk add config

void debuglog_protocol(const char* fmt, ...)
{
if (g_verbose)
if (g_verbose_logs)
{
va_list ap;

Expand Down
Loading