1
0

make flow not suck

This commit is contained in:
dtb 2023-11-25 09:26:33 -07:00
parent 86289e3609
commit b5c73d1fc4

View File

@ -55,237 +55,132 @@ play_level(void)
{ {
short ch; short ch;
int count; int count;
enum { NORMAL, COUNTED, CHECK } state;
state = NORMAL;
for (;;) { for(;;){
interrupted = 0; switch(state){
if (hit_message[0]) { case NORMAL:
messagef(1, "%s", hit_message); interrupted = 0;
hit_message[0] = 0; if (hit_message[0]){
messagef(1, "%s", hit_message);
hit_message[0] = 0;
}
if(trap_door){
trap_door = 0;
return;
}
move(rogue.row, rogue.col);
refresh();
ch = rgetchar();
case CHECK:
check_message();
count = 0;
} }
if (trap_door) { state = NORMAL;
trap_door = 0; switch(ch){
return; case '.': rest((count > 0) ? count : 1); break;
} case 's': search(((count > 0) ? count : 1), 0); break;
move(rogue.row, rogue.col); case 'i': inventory(&rogue.pack, ALL_OBJECTS); break;
refresh(); case 'f': fight(0); break;
case 'F': fight(1); break;
ch = rgetchar(); case 'h': case 'j': case 'k': case 'l': case 'y': case 'u':
CMCH: case 'n': case 'b':
check_message();
count = 0;
CH:
switch(ch) {
case '.':
rest((count > 0) ? count : 1);
break;
case 's':
search(((count > 0) ? count : 1), 0);
break;
case 'i':
inventory(&rogue.pack, ALL_OBJECTS);
break;
case 'f':
fight(0);
break;
case 'F':
fight(1);
break;
case 'h':
case 'j':
case 'k':
case 'l':
case 'y':
case 'u':
case 'n':
case 'b':
(void)one_move_rogue(ch, 1); (void)one_move_rogue(ch, 1);
break; break;
case 'H': case 'H': case 'J': case 'K': case 'L': case 'Y': case 'U':
case 'J': case 'N': case 'B': case '\010': case '\012': case '\013':
case 'K': case '\014': case '\031': case '\025': case '\016':
case 'L': case '\002': multiple_move_rogue(ch); break;
case 'B': case 'e': eat(); break;
case 'Y': case 'q': quaff(); break;
case 'U': case 'r': read_scroll(); break;
case 'N': case 'm': move_onto(); break;
case '\010': case ',': kick_into_pack(); break;
case '\012': case 'd': drop(); break;
case '\013': case 'P': put_on_ring(); break;
case '\014': case 'R': remove_ring(); break;
case '\031':
case '\025':
case '\016':
case '\002':
multiple_move_rogue(ch);
break;
case 'e':
eat();
break;
case 'q':
quaff();
break;
case 'r':
read_scroll();
break;
case 'm':
move_onto();
break;
case ',':
kick_into_pack();
break;
case 'd':
drop();
break;
case 'P':
put_on_ring();
break;
case 'R':
remove_ring();
break;
case '\020': case '\020':
do { do {
remessage(count++); remessage(count++);
ch = rgetchar(); ch = rgetchar();
} while (ch == '\020'); } while (ch == '\020');
goto CMCH; state = CHECK;
break; break;
case '\027': case '\027': wizardize(); break;
wizardize(); case '>': if(drop_check())
break; return;
case '>': break;
if (drop_check()) { case '<': if(check_up())
return; return;
} break;
break; case ')': case ']':
case '<':
if (check_up()) {
return;
}
break;
case ')':
case ']':
inv_armor_weapon(ch == ')'); inv_armor_weapon(ch == ')');
break; break;
case '=': case '=': inv_rings(); break;
inv_rings(); case '^': id_trap(); break;
break; case '/': id_type(); break;
case '^': case '?': id_com(); break;
id_trap(); case '!': do_shell(); break;
break; case 'o': edit_opts(); break;
case '/': case 'I': single_inv(0); break;
id_type(); case 'T': take_off(); break;
break; case 'W': wear(); break;
case '?': case 'w': wield(); break;
id_com(); case 'c': call_it(); break;
break; case 'z': zapp(); break;
case '!': case 't': throw(); break;
do_shell();
break;
case 'o':
edit_opts();
break;
case 'I':
single_inv(0);
break;
case 'T':
take_off();
break;
case 'W':
wear();
break;
case 'w':
wield();
break;
case 'c':
call_it();
break;
case 'z':
zapp();
break;
case 't':
throw();
break;
case 'v': case 'v':
messagef(0, "rogue-clone: Version III. (Tim Stoehr was here), tektronix!zeus!tims"); messagef(0, "rogue-clone: Version III (trinity mod)."
" (Tim Stoehr was here), tektronix!zeus!tims");
break; break;
case 'Q': case 'Q': quit(0);
quit(0); case '0': case '1': case '2': case '3': case '4': case '5':
__unreachable(); case '6': case '7': case '8': case '9':
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
move(rogue.row, rogue.col); move(rogue.row, rogue.col);
refresh(); refresh();
do { do{
if (count < 100) { if(count < 100)
count = (10 * count) + (ch - '0'); count = (10 * count) + (ch - '0');
}
ch = rgetchar(); ch = rgetchar();
} while (is_digit(ch)); }while (is_digit(ch));
if (ch != CANCEL) { if(ch != CANCEL)
goto CH; state = COUNTED;
}
break;
case ' ':
break;
case '\011':
if (wizard) {
inventory(&level_objects, ALL_OBJECTS);
} else {
messagef(0, "%s", unknown_command);
}
break;
case '\023':
if (wizard) {
draw_magic_map();
} else {
messagef(0, "%s", unknown_command);
}
break;
case '\024':
if (wizard) {
show_traps();
} else {
messagef(0, "%s", unknown_command);
}
break;
case '\017':
if (wizard) {
show_objects();
} else {
messagef(0, "%s", unknown_command);
}
break;
case '\001':
show_average_hp();
break;
case '\003':
if (wizard) {
c_object_for_wizard();
} else {
messagef(0, "%s", unknown_command);
}
break;
case '\015':
if (wizard) {
show_monsters();
} else {
messagef(0, "%s", unknown_command);
}
break;
case 'S':
save_game();
break;
default:
messagef(0, "%s", unknown_command);
break; break;
case ' ': break;
case '\011': if(!wizard){
messagef(0, "%s", unknown_command);
break;
}
inventory(&level_objects, ALL_OBJECTS); break;
case '\023': if(!wizard){
messagef(0, "%s", unknown_command);
break;
}
draw_magic_map(); break;
case '\024': if(!wizard)
messagef(0, "%s", unknown_command);
break;
}
show_traps(); break;
case '\017': if(!wizard)
messagef(0, "%s", unknown_command);
break;
}
show_objects(); break;
case '\001': show_average_hp(); break;
case '\003': if(!wizard)
messagef(0, "%s", unknown_command);
break;
}
c_object_for_wizard(); break;
case '\015': if(!wizard)
messagef(0, "%s", unknown_command);
break;
}
show_monsters(); break;
case 'S': save_game(); break;
default: messagef(0, "%s", unknown_command); break;
} }
} }
} }