Two relative walking modes: Relturn: Turn or walk only. Relwalk: Turn and walk. Relsee: See reports of turns. structs.h 997: int facing; /**< Direction char is facing. */ int directional_subcommand; /**< Player's command. */ act.h 146: /** Relative north. */ #define FACING ((ch)->facing) #define DIR_SCMD ((ch)->directional_subcommand) act.movement.c 31: void spin_char(struct char_data *ch, int subcmd); void show_char_spin(struct char_data *ch); bool should_show_char_move_and_spin(struct char_data *ch); void show_char_move_and_spin(struct char_data *ch); 117: void spin_char(struct char_data *ch, int subcmd) { switch (subcmd) { case (EAST): { FACING++; if (FACING == 4) FACING = 0; break; } case (SOUTH): { FACING += 2; if (FACING == 4) FACING = 0; if (FACING == 5) FACING = 1; break; } case (WEST): { FACING--; if (FACING == -1) FACING = 3; } } } void show_char_spin(struct char_data *ch) { if (GET_LEVEL(ch) < LVL_IMMORT) send_to_char (ch, (DIR_SCMD == 1) ? "You turn right.\r\n" : (DIR_SCMD == 2) ? "You turn around.\r\n" :( "You turn left.\r\n")); else // immortal characters know their cardinal direction { send_to_char (ch, (DIR_SCMD != 2) ? "You face " : ("You turn around and face ")); send_to_char (ch, (FACING == 0) ? "north.\r\n" : (FACING == 1) ? "east.\r\n" :( (FACING == 2) ? "south.\r\n" :( "west.\r\n"))); } } bool should_show_char_move_and_spin(struct char_data *ch) { return ((!IS_NPC(ch)) && PRF_FLAGGED(ch, PRF_RELSEE) // seeing spinning wanted && PRF_FLAGGED(ch, PRF_RELWALK) // walking and spinning mode && (DIR_SCMD == EAST || DIR_SCMD == SOUTH || DIR_SCMD == WEST)); // spinning } void show_char_move_and_spin(struct char_data *ch) { if (GET_LEVEL(ch) < LVL_IMMORT) send_to_char (ch, (DIR_SCMD == 1) ? "You turn and walk right.\r\n" : (DIR_SCMD == 2) ? "You turn around and walk.\r\n" :( "You turn and walk left.\r\n")); else { send_to_char (ch, (DIR_SCMD != 2) ? "You turn and walk " : ("You turn around and walk ")); send_to_char (ch, (FACING == 0) ? "north.\r\n" : (FACING == 1) ? "east.\r\n" :( (FACING == 2) ? "south.\r\n" :( "west.\r\n"))); } } 361: if (should_show_char_move_and_spin(ch)) show_char_move_and_spin(ch); /*---------------------------------------------------------------------*/ /* End: the leave operation. The character is now in the new room. */ 452: ACMD(do_move) { DIR_SCMD = subcmd; if ((!IS_NPC(ch)) && PRF_FLAGGED(ch, PRF_RELWALK)) { if (subcmd == NORTH) perform_move(ch, FACING, 0); else if ((subcmd > 0) && (subcmd < 4)) { spin_char(ch, subcmd); perform_move(ch, FACING, 0); } else perform_move(ch, subcmd, 0); } else if ((!IS_NPC(ch)) && PRF_FLAGGED(ch, PRF_RELTURN)) { if (subcmd == NORTH) perform_move(ch, FACING, 0); else if ((subcmd > 0) && (subcmd < 4)) { spin_char(ch, subcmd); if PRF_FLAGGED(ch, PRF_RELSEE) show_char_spin(ch); } else perform_move(ch, subcmd, 0); } else /* These subcmd defines are mapped precisely to the direction defines. */ perform_move(ch, subcmd, 0); } structs.h 259: #define PRF_RELTURN 34 /**< Turn then walk */ #define PRF_RELWALK 35 /**< Walk and turn */ #define PRF_RELSEE 36 /**< See relative north movements */ constants.c 235: "RELTURN", "RELWALK", "RELSEE", interpreter.c 260: { "relturn" , "relt" , POS_DEAD , do_gen_tog , 0, SCMD_RELTURN }, { "relwalk" , "relw" , POS_DEAD , do_gen_tog , 0, SCMD_RELWALK }, { "relsee" , "rels" , POS_DEAD , do_gen_tog , 0, SCMD_RELSEE }, act.h 231: #define SCMD_RELTURN 28 #define SCMD_RELWALK 29 #define SCMD_RELSEE 30 #define SCMD_COLOR 31 #define SCMD_SYSLOG 32 #define SCMD_WIMPY 33 #define SCMD_PAGELENGTH 34 #define SCMD_SCREENWIDTH 35 act.other.c 750: {"Relturn disabled.\r\n", "Relturn enabled.\r\n"}, {"Relwalk disabled.\r\n", "Relwalk enabled.\r\n"}, {"Relsee disabled.\r\n", "Relsee enabled.\r\n"} act.other.c 857: case SCMD_RELTURN: result = PRF_TOG_CHK(ch, PRF_RELTURN); if PRF_FLAGGED(ch, PRF_RELWALK) { REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_RELWALK); if PRF_FLAGGED(ch, PRF_RELSEE) send_to_char(ch, "%s", tog_messages[subcmd+1][TOG_OFF]); } break; case SCMD_RELWALK: result = PRF_TOG_CHK(ch, PRF_RELWALK); if PRF_FLAGGED(ch, PRF_RELTURN) { REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_RELTURN); if PRF_FLAGGED(ch, PRF_RELSEE) send_to_char(ch, "%s", tog_messages[subcmd-1][TOG_OFF]); } break; case SCMD_RELSEE: result = PRF_TOG_CHK(ch, PRF_RELSEE); break; act.informative.c 1898: {"relturn", PRF_RELTURN, 0, "Turn then walk.\r\n", "Walk.\r\n"}, {"relwalk", PRF_RELWALK, 0, "Turn and walk.\r\n", "Walk.\r\n"}, {"relsee", PRF_RELSEE, 0, "See relative north movements.\r\n", "Don't see relative north movements.\r\n"}, {"color", 0, 0, "\n", "\n"}, {"syslog", 0, LVL_IMMORT, "\n", "\n"}, {"wimpy", 0, 0, "\n", "\n"}, {"pagelength", 0, 0, "\n", "\n"}, {"screenwidth", 0, 0, "\n", "\n"}, {"\n", 0, -1, "\n", "\n"} /* must be last */ }; act.informative.c 2031: ONOFF(PRF_FLAGGED(ch, PRF_RELTURN)), ONOFF(PRF_FLAGGED(ch, PRF_RELWALK)), ONOFF(PRF_FLAGGED(ch, PRF_RELSEE)),