1
0

remove coin_toss()

This commit is contained in:
dtb 2023-11-25 10:53:26 -07:00
parent c97425f1f4
commit b452c5e230
7 changed files with 25 additions and 20 deletions

View File

@ -1,6 +1,6 @@
OBJ = hit.o init.o inventory.o level.o machdep.o main.o message.o monster.o \
move.o object.o pack.o play.o random.o ring.o room.o save.o score.o \
spec_hit.o throw.o trap.o use.o zap.o
move.o object.o pack.o play.o ring.o room.o save.o score.o spec_hit.o \
throw.o trap.o use.o zap.o
rogue: $(OBJ)
$(CC) $(CFLAGS) -lcurses -o $@ $(OBJ)

View File

@ -44,6 +44,8 @@
*
*/
#include <stdlib.h> /* rand(3) */
#include "random.h"
#include "rogue.h"
@ -514,7 +516,7 @@ fill_out_level(void)
for (i = 0; i < MAXROOMS; i++) {
rn = random_rooms[i];
if ((rooms[rn].is_room & R_NOTHING) ||
((rooms[rn].is_room & R_CROSS) && coin_toss())) {
((rooms[rn].is_room & R_CROSS) && (rand() & 1))) {
fill_it(rn, 1);
}
}
@ -572,9 +574,8 @@ fill_it(int rn, boolean do_rec_de)
if ((i < 3) && (!did_this)) {
did_this = 1;
if (coin_toss()) {
if(rand() & 1)
continue;
}
}
if ((rooms_found < 2) && do_rec_de) {
recursive_deadend(rn, offsets, srow, scol);

View File

@ -44,14 +44,17 @@
*
*/
#include <stdlib.h> /* srand(3) */
#include <time.h> /* time(3) */
#include "rogue.h"
int
main(int argc, char *argv[])
{
if (init(argc, argv)) { /* restored game */
main(int argc, char *argv[]){
srand(time(NULL));
if(init(argc, argv)) /* restored game */
goto PL;
}
for (;;) {
clear_level();
@ -62,8 +65,7 @@ main(int argc, char *argv[])
put_mons();
put_player(party_room);
print_stats(STAT_ALL);
PL:
play_level();
PL: play_level();
free_stuff(&level_objects);
free_stuff(&level_monsters);
}

View File

@ -44,6 +44,8 @@
*
*/
#include <stdlib.h> /* rand(3) */
#include "random.h"
#include "rogue.h"
@ -134,7 +136,7 @@ put_mons(void)
for (i = 0; i < n; i++) {
monster = gr_monster(NULL, 0);
if ((monster->m_flags & WANDERS) && coin_toss()) {
if ((monster->m_flags & WANDERS) && (rand() & 1)) {
wake_up(monster);
}
gr_row_col(&row, &col, (FLOOR | TUNNEL | STAIRS | OBJECT));
@ -750,7 +752,7 @@ move_confused(object *monster)
monster->m_flags &= (~CONFUSED);
}
if (monster->m_flags & STATIONARY) {
return(coin_toss() ? 1 : 0);
return rand() & 1;
} else if (rand_percent(15)) {
return(1);
}

View File

@ -44,6 +44,8 @@
*
*/
#include <stdlib.h> /* rand(3) */
#include "random.h"
#include "rogue.h"
@ -393,9 +395,8 @@ check_hunger(boolean msg_only)
}
messagef(1, "you faint");
for (i = 0; i < n; i++) {
if (coin_toss()) {
if(rand() & 1)
mv_mons();
}
}
messagef(1, "%s", you_can_move_again);
}

View File

@ -44,6 +44,7 @@
*
*/
#include <stdlib.h> /* rand(3) */
#include "random.h"
#include "rogue.h"
@ -174,7 +175,7 @@ put_objects(void)
if (cur_level < max_level) {
return;
}
n = coin_toss() ? get_rand(2, 4) : get_rand(3, 5);
n = get_rand(2, 4) + (rand() & 1);
while (rand_percent(33)) {
n++;
}
@ -517,11 +518,10 @@ gr_weapon(object *obj, int assign_wk)
obj->is_cursed = 1;
}
for (i = 0; i < blessing; i++) {
if (coin_toss()) {
if(rand() & 1)
obj->hit_enchant += increment;
} else {
else
obj->d_enchant += increment;
}
}
}
switch(obj->which_kind) {

View File

@ -474,7 +474,6 @@ int check_up(void);
void clean_up(const char *) __dead;
void clear_level(void);
void cnfs(void);
int coin_toss(void);
void cough_up(object *);
void create_monster(void);
void darken_room(short);