| 1 |
--- omega-rpg-0.90-pa9.orig/char.c |
| 2 |
+++ omega-rpg-0.90-pa9/char.c |
| 3 |
@@ -17,7 +17,7 @@ |
| 4 |
int oldchar=FALSE; |
| 5 |
FILE *fd; |
| 6 |
char *lname; |
| 7 |
- int ret_value = FALSE; |
| 8 |
+ int loaded = FALSE; |
| 9 |
#ifndef MSDOS |
| 10 |
struct passwd *dastuff; |
| 11 |
#endif |
| 12 |
@@ -81,18 +81,20 @@ |
| 13 |
optionset(COMPRESS_OPTION); |
| 14 |
#endif |
| 15 |
optionset(SHOW_COLOUR); |
| 16 |
- ret_value = initstats() ; /* RM 04-19-2000:loading patch */ /* DAG */ |
| 17 |
+ loaded = initstats() ; /* RM 04-19-2000:loading patch */ /* DAG */ |
| 18 |
} |
| 19 |
/* This gets executed when the player loads from .omegarc */ |
| 20 |
/* DAG - put the code back in the same place, rather than duplicating */ |
| 21 |
Searchnum = max(1,min(9,Searchnum)); |
| 22 |
- Player.hp = Player.maxhp = Player.maxcon; |
| 23 |
- Player.mana = Player.maxmana = calcmana(); |
| 24 |
- Player.click = 1; |
| 25 |
- strcpy(Player.meleestr,"CCBC"); |
| 26 |
+ if (!loaded) { |
| 27 |
+ Player.hp = Player.maxhp = Player.maxcon; |
| 28 |
+ Player.mana = Player.maxmana = calcmana(); |
| 29 |
+ Player.click = 1; |
| 30 |
+ strcpy(Player.meleestr,"CCBC"); |
| 31 |
+ } |
| 32 |
calc_melee(); |
| 33 |
ScreenOffset = -1000; /* to force a redraw */ |
| 34 |
- return ret_value; /* RM 04-19-2000: loading patch */ /* DAG */ |
| 35 |
+ return loaded; /* RM 04-19-2000: loading patch */ /* DAG */ |
| 36 |
} |
| 37 |
|
| 38 |
|
| 39 |
@@ -103,7 +105,7 @@ |
| 40 |
if ((fd = fopen("omega.rc","rb")) != NULL) { |
| 41 |
print2("Use omega.rc charcter record in current directory? [yn] "); |
| 42 |
#else |
| 43 |
- sprintf(Str1, "%s/.omegarc", getenv("HOME")); |
| 44 |
+ snprintf(Str1, sizeof(Str1)-1, "%s/.omegarc", getenv("HOME")); |
| 45 |
if ((fd = fopen(Str1,"r")) != NULL) { |
| 46 |
print2("Use .omegarc in home directory? [yn] "); |
| 47 |
#endif |
| 48 |
@@ -160,7 +162,7 @@ |
| 49 |
#if defined(MSDOS) || defined(AMIGA) |
| 50 |
fd = fopen("omega.rc","wb"); |
| 51 |
#else |
| 52 |
- sprintf(Str1, "%s/.omegarc", getenv("HOME")); |
| 53 |
+ snprintf(Str1, sizeof(Str1)-1, "%s/.omegarc", getenv("HOME")); |
| 54 |
fd = fopen(Str1,"w"); |
| 55 |
#endif |
| 56 |
if (fd == NULL) |
| 57 |
--- omega-rpg-0.90-pa9.orig/omega.c |
| 58 |
+++ omega-rpg-0.90-pa9/omega.c |
| 59 |
@@ -22,6 +22,7 @@ |
| 60 |
/* most globals originate in omega.c */ |
| 61 |
|
| 62 |
char *Omegalib; /* contains the path to the library files */ |
| 63 |
+char *Omegavar; /* contains the path to the highscore and log files */ |
| 64 |
|
| 65 |
#ifdef DEBUG |
| 66 |
FILE *DG_debug_log; /* debug log file pointer */ |
| 67 |
@@ -300,13 +301,13 @@ |
| 68 |
} else { |
| 69 |
/* savefile given */ |
| 70 |
continuing = 1; |
| 71 |
- strcpy(SaveFileName,argv[optind]); |
| 72 |
+ strncpy(SaveFileName,argv[optind],sizeof(SaveFileName)-1); |
| 73 |
} |
| 74 |
|
| 75 |
#else |
| 76 |
/* alternate code for people who don't support getopt() -- no enhancement */ |
| 77 |
if (argc ==2) { |
| 78 |
- strcpy( SaveFileName, argv[1]); |
| 79 |
+ strncpy( SaveFileName, argv[1], sizeof(SaveFileName)-1); |
| 80 |
continuing = 1; |
| 81 |
} else { |
| 82 |
strcpy( SaveFileName,"Omega"); |
| 83 |
@@ -358,6 +359,11 @@ |
| 84 |
#endif |
| 85 |
Omegalib = OMEGALIB; |
| 86 |
|
| 87 |
+#ifndef FIXED_OMEGALIB |
| 88 |
+ if (!(Omegavar = getenv("OMEGAVAR"))) |
| 89 |
+#endif |
| 90 |
+ Omegavar = OMEGAVAR; |
| 91 |
+ |
| 92 |
/* if filecheck is 0, some necessary data files are missing */ |
| 93 |
if (filecheck() == 0) exit(0); |
| 94 |
|
| 95 |
--- omega-rpg-0.90-pa9.orig/gen2.c |
| 96 |
+++ omega-rpg-0.90-pa9/gen2.c |
| 97 |
@@ -243,7 +243,13 @@ |
| 98 |
|
| 99 |
|
| 100 |
/* corridor which is guaranteed to connect */ |
| 101 |
- findspace(&tx,&ty,i); |
| 102 |
+ |
| 103 |
+ /* If there is no starting point for it, then our current room |
| 104 |
+ * might have been big enough to wipe out all previous rooms on |
| 105 |
+ * the level (it's rare but possible). In that case just consider |
| 106 |
+ * this the new first room, and continue. -- Richard Braakman */ |
| 107 |
+ if (!try_findspace(&tx,&ty,i)) |
| 108 |
+ continue; |
| 109 |
|
| 110 |
/* figure out where to start corridor from */ |
| 111 |
if ((ty <= t) && (tx <= l+e)) { |
| 112 |
@@ -390,79 +396,79 @@ |
| 113 |
case 4: rsi = RS_FIREPLANE; break; |
| 114 |
case 5: rsi = RS_HIGHASTRAL; break; |
| 115 |
} |
| 116 |
+ } |
| 117 |
|
| 118 |
- maze_corridor(1 + random_range(Level->level_width - 1), |
| 119 |
- 1 + random_range(Level->level_length - 1), |
| 120 |
- 1 + random_range(Level->level_width - 1), |
| 121 |
- 1 + random_range(Level->level_length - 1), |
| 122 |
- rsi, |
| 123 |
- 0); |
| 124 |
+ maze_corridor(1 + random_range(Level->level_width - 1), |
| 125 |
+ 1 + random_range(Level->level_length - 1), |
| 126 |
+ 1 + random_range(Level->level_width - 1), |
| 127 |
+ 1 + random_range(Level->level_length - 1), |
| 128 |
+ rsi, |
| 129 |
+ 0); |
| 130 |
|
| 131 |
- if (E_ASTRAL == Current_Dungeon) |
| 132 |
+ if (E_ASTRAL == Current_Environment) |
| 133 |
+ { |
| 134 |
+ for (x_idx = 0; x_idx < Level->level_width; ++x_idx) |
| 135 |
{ |
| 136 |
- for (x_idx = 0; x_idx < Level->level_width; ++x_idx) |
| 137 |
+ for (y_idx = 0; y_idx < Level->level_length; ++y_idx) |
| 138 |
{ |
| 139 |
- for (y_idx = 0; y_idx < Level->level_length; ++y_idx) |
| 140 |
+ if (WALL == Level->site[x_idx][y_idx].locchar) |
| 141 |
{ |
| 142 |
- if (WALL == Level->site[x_idx][y_idx].locchar) |
| 143 |
+ switch (Level->depth) |
| 144 |
{ |
| 145 |
- switch (Level->depth) |
| 146 |
- { |
| 147 |
- case 1: |
| 148 |
- Level->site[x_idx][y_idx].aux = 500; |
| 149 |
- break; |
| 150 |
- |
| 151 |
- case 2: |
| 152 |
- Level->site[x_idx][y_idx].locchar = WHIRLWIND; |
| 153 |
- Level->site[x_idx][y_idx].p_locf = L_WHIRLWIND; |
| 154 |
- break; |
| 155 |
- |
| 156 |
- case 3: |
| 157 |
- Level->site[x_idx][y_idx].locchar = WATER; |
| 158 |
- Level->site[x_idx][y_idx].p_locf = L_WATER; |
| 159 |
- break; |
| 160 |
- |
| 161 |
- case 4: |
| 162 |
- Level->site[x_idx][y_idx].locchar = FIRE; |
| 163 |
- Level->site[x_idx][y_idx].p_locf = L_FIRE; |
| 164 |
- break; |
| 165 |
- |
| 166 |
- case 5: |
| 167 |
- Level->site[x_idx][y_idx].locchar = ABYSS; |
| 168 |
- Level->site[x_idx][y_idx].p_locf = L_ABYSS; |
| 169 |
- break; |
| 170 |
- } |
| 171 |
+ case 1: |
| 172 |
+ Level->site[x_idx][y_idx].aux = 500; |
| 173 |
+ break; |
| 174 |
+ |
| 175 |
+ case 2: |
| 176 |
+ Level->site[x_idx][y_idx].locchar = WHIRLWIND; |
| 177 |
+ Level->site[x_idx][y_idx].p_locf = L_WHIRLWIND; |
| 178 |
+ break; |
| 179 |
+ |
| 180 |
+ case 3: |
| 181 |
+ Level->site[x_idx][y_idx].locchar = WATER; |
| 182 |
+ Level->site[x_idx][y_idx].p_locf = L_WATER; |
| 183 |
+ break; |
| 184 |
+ |
| 185 |
+ case 4: |
| 186 |
+ Level->site[x_idx][y_idx].locchar = FIRE; |
| 187 |
+ Level->site[x_idx][y_idx].p_locf = L_FIRE; |
| 188 |
+ break; |
| 189 |
+ |
| 190 |
+ case 5: |
| 191 |
+ Level->site[x_idx][y_idx].locchar = ABYSS; |
| 192 |
+ Level->site[x_idx][y_idx].p_locf = L_ABYSS; |
| 193 |
+ break; |
| 194 |
} |
| 195 |
} |
| 196 |
+ } |
| 197 |
+ } |
| 198 |
|
| 199 |
- switch (Level->depth) |
| 200 |
- { |
| 201 |
- case 1: mid = LORD_EARTH; break; /* Elemental Lord of Earth */ |
| 202 |
- case 2: mid = LORD_AIR; break; /* Elemental Lord of Air */ |
| 203 |
- case 3: mid = LORD_WATER; break; /* Elemental Lord of Water */ |
| 204 |
- case 4: mid = LORD_FIRE; break; /* Elemental Lord of Fire */ |
| 205 |
- case 5: mid = ELEM_MASTER; break; /* Elemental Master */ |
| 206 |
- default: mid = ELEM_MASTER; assert(FALSE); /* bomb if this happens */ |
| 207 |
- } |
| 208 |
+ switch (Level->depth) |
| 209 |
+ { |
| 210 |
+ case 1: mid = LORD_EARTH; break; /* Elemental Lord of Earth */ |
| 211 |
+ case 2: mid = LORD_AIR; break; /* Elemental Lord of Air */ |
| 212 |
+ case 3: mid = LORD_WATER; break; /* Elemental Lord of Water */ |
| 213 |
+ case 4: mid = LORD_FIRE; break; /* Elemental Lord of Fire */ |
| 214 |
+ case 5: mid = ELEM_MASTER; break; /* Elemental Master */ |
| 215 |
+ default: mid = ELEM_MASTER; assert(FALSE); /* bomb if this happens */ |
| 216 |
+ } |
| 217 |
|
| 218 |
- if (5 == Level->depth) |
| 219 |
- { |
| 220 |
- findspace(&tx, &ty, -1); |
| 221 |
- Level->site[tx][ty].p_locf = L_ENTER_CIRCLE; |
| 222 |
- Level->site[tx][ty].locchar = STAIRS_DOWN; |
| 223 |
- } |
| 224 |
+ if (5 == Level->depth) |
| 225 |
+ { |
| 226 |
+ findspace(&tx, &ty, -1); |
| 227 |
+ Level->site[tx][ty].p_locf = L_ENTER_CIRCLE; |
| 228 |
+ Level->site[tx][ty].locchar = STAIRS_DOWN; |
| 229 |
+ } |
| 230 |
|
| 231 |
- if (!gamestatusp(COMPLETED_ASTRAL)) |
| 232 |
- { |
| 233 |
- findspace(&tx, &ty, -1); |
| 234 |
- Level->mlist = checkmalloc(sizeof(mltype)); |
| 235 |
- Level->mlist->next = NULL; |
| 236 |
- Level->mlist->m = make_creature(mid); |
| 237 |
- Level->mlist->m->x = tx; |
| 238 |
- Level->mlist->m->y = ty; |
| 239 |
- Level->site[tx][ty].creature = Level->mlist->m; |
| 240 |
- } |
| 241 |
- } |
| 242 |
+ if (!gamestatusp(COMPLETED_ASTRAL)) |
| 243 |
+ { |
| 244 |
+ findspace(&tx, &ty, -1); |
| 245 |
+ Level->mlist = checkmalloc(sizeof(mltype)); |
| 246 |
+ Level->mlist->next = NULL; |
| 247 |
+ Level->mlist->m = make_creature(mid); |
| 248 |
+ Level->mlist->m->x = tx; |
| 249 |
+ Level->mlist->m->y = ty; |
| 250 |
+ Level->site[tx][ty].creature = Level->mlist->m; |
| 251 |
} |
| 252 |
} |
| 253 |
else if (E_VOLCANO == Current_Environment) |
| 254 |
--- omega-rpg-0.90-pa9.orig/file.c |
| 255 |
+++ omega-rpg-0.90-pa9/file.c |
| 256 |
@@ -14,6 +14,7 @@ |
| 257 |
# include <curses.h> |
| 258 |
# endif |
| 259 |
# include <sys/types.h> |
| 260 |
+# include <sys/stat.h> |
| 261 |
# include <unistd.h> |
| 262 |
# include <sys/file.h> |
| 263 |
# include <fcntl.h> |
| 264 |
@@ -160,13 +161,13 @@ |
| 265 |
|
| 266 |
FILE * lockfile; |
| 267 |
|
| 268 |
- strcpy(Str1,Omegalib); |
| 269 |
+ strcpy(Str1,Omegavar); |
| 270 |
strcat(Str1,"omega.hi.lock"); |
| 271 |
|
| 272 |
do |
| 273 |
{ |
| 274 |
/* create lock file */ |
| 275 |
- lock = open(Str1, O_CREAT | O_EXCL, 0600); |
| 276 |
+ lock = open(Str1, O_WRONLY | O_CREAT | O_EXCL, 0600); |
| 277 |
if (lock < 0 && errno == EEXIST) |
| 278 |
{ |
| 279 |
lockfile = fopen(Str1, "rb"); |
| 280 |
@@ -206,7 +207,7 @@ |
| 281 |
void unlock_score_file(void) |
| 282 |
{ |
| 283 |
#ifndef MSDOS |
| 284 |
- strcpy(Str1,Omegalib); |
| 285 |
+ strcpy(Str1,Omegavar); |
| 286 |
strcat(Str1,"omega.hi.lock"); |
| 287 |
unlink(Str1); |
| 288 |
#endif |
| 289 |
@@ -218,7 +219,7 @@ |
| 290 |
int i; |
| 291 |
|
| 292 |
lock_score_file(); |
| 293 |
- strcpy(Str1,Omegalib); |
| 294 |
+ strcpy(Str1,Omegavar); |
| 295 |
strcat(Str1,"omega.hi"); |
| 296 |
fd = checkfopen(Str1,"rb"); |
| 297 |
filescanstring(fd,Hiscorer); |
| 298 |
@@ -302,10 +303,10 @@ |
| 299 |
if (gamestatusp(CHEATED)) |
| 300 |
return; |
| 301 |
lock_score_file(); |
| 302 |
- strcpy(Str1,Omegalib); |
| 303 |
+ strcpy(Str1,Omegavar); |
| 304 |
strcat(Str1,"omega.hi"); |
| 305 |
infile = checkfopen(Str1,"rb"); |
| 306 |
- strcpy(Str2,Omegalib); |
| 307 |
+ strcpy(Str2,Omegavar); |
| 308 |
#ifdef MSDOS |
| 309 |
strcat(Str2,"omegahi.new"); /* stupid 8.3 msdos filename limit */ |
| 310 |
#else |
| 311 |
@@ -377,6 +378,7 @@ |
| 312 |
} |
| 313 |
fclose(infile); |
| 314 |
fclose(outfile); |
| 315 |
+ chmod(Str2, 0664); |
| 316 |
unlink(Str1); |
| 317 |
#if defined(MSDOS) || defined(AMIGA) |
| 318 |
rename(Str2, Str1); |
| 319 |
@@ -434,7 +436,7 @@ |
| 320 |
change_to_game_perms(); |
| 321 |
npcbehavior=fixnpc(lifestatus); |
| 322 |
checkhigh(descrip,npcbehavior); |
| 323 |
- strcpy(Str1,Omegalib); |
| 324 |
+ strcpy(Str1,Omegavar); |
| 325 |
strcat(Str1,"omega.log"); |
| 326 |
fd = checkfopen(Str1,"a"); |
| 327 |
fprintf(fd, " %d %d %d %s\n", lifestatus, Player.level, npcbehavior, |
| 328 |
@@ -496,10 +498,15 @@ |
| 329 |
|
| 330 |
char *required_file_list[] = |
| 331 |
{ |
| 332 |
- "maps.dat", "omega.hi", "omega.log", "motd.txt", |
| 333 |
+ "maps.dat", "motd.txt", |
| 334 |
"license.txt", NULL |
| 335 |
}; |
| 336 |
|
| 337 |
+char *required_writeable[] = |
| 338 |
+{ |
| 339 |
+ "omega.hi", "omega.log", NULL |
| 340 |
+}; |
| 341 |
+ |
| 342 |
char *optional_file_list[] = |
| 343 |
{ |
| 344 |
"help1.txt", "help2.txt", "help3.txt", "help4.txt", "help5.txt", |
| 345 |
@@ -516,24 +523,30 @@ |
| 346 |
int endpos; |
| 347 |
int file; |
| 348 |
|
| 349 |
- strcpy(Str1, Omegalib); |
| 350 |
+ strcpy(Str1, Omegavar); |
| 351 |
endpos = strlen(Str1); |
| 352 |
- for (file = 0; required_file_list[file]; file++) |
| 353 |
+ for (file = 0; required_writeable[file]; file++) |
| 354 |
{ |
| 355 |
- strcpy(&(Str1[endpos]), required_file_list[file]); |
| 356 |
- if ((strcmp(required_file_list[file], "omega.hi") == 0 || |
| 357 |
- strcmp(required_file_list[file], "omega.log") == 0) && |
| 358 |
- test_file_access(Str1, 'w') == 0) |
| 359 |
+ strcpy(&(Str1[endpos]), required_writeable[file]); |
| 360 |
+ if (test_file_access(Str1, 'w') == 0) |
| 361 |
{ |
| 362 |
impossible = TRUE; |
| 363 |
printf("\nError! File not appendable or accessible: %s", Str1); |
| 364 |
} |
| 365 |
- else if (test_file_access(Str1, 'r') == 0) |
| 366 |
+ } |
| 367 |
+ |
| 368 |
+ strcpy(Str1, Omegalib); |
| 369 |
+ endpos = strlen(Str1); |
| 370 |
+ for (file = 0; required_file_list[file]; file++) |
| 371 |
+ { |
| 372 |
+ strcpy(&(Str1[endpos]), required_file_list[file]); |
| 373 |
+ if (test_file_access(Str1, 'r') == 0) |
| 374 |
{ |
| 375 |
impossible = TRUE; |
| 376 |
printf("\nError! File not accessible: %s", Str1); |
| 377 |
} |
| 378 |
} |
| 379 |
+ |
| 380 |
for (file = 0; optional_file_list[file]; file++) |
| 381 |
{ |
| 382 |
strcpy(&(Str1[endpos]), optional_file_list[file]); |
| 383 |
@@ -545,13 +558,13 @@ |
| 384 |
} |
| 385 |
if (impossible) { |
| 386 |
printf("\nFurther execution is impossible. Sorry."); |
| 387 |
- if (strcmp(Omegalib, OMEGALIB)) |
| 388 |
+ if (strcmp(Omegavar, OMEGALIB)) |
| 389 |
printf("\nEnvironment variable OMEGALIB badly set\n"); |
| 390 |
else { |
| 391 |
printf("\nOMEGALIB may be badly #defined in defs.h\n"); |
| 392 |
#ifndef FIXED_OMEGALIB |
| 393 |
printf("\nYou can set the environment variable OMEGALIB to\n"); |
| 394 |
- printf("the location of the omegalib directory.\n"); |
| 395 |
+ printf("the location of the omegavar directory.\n"); |
| 396 |
#endif |
| 397 |
} |
| 398 |
return(0); |
| 399 |
--- omega-rpg-0.90-pa9.orig/util.c |
| 400 |
+++ omega-rpg-0.90-pa9/util.c |
| 401 |
@@ -850,6 +850,21 @@ |
| 402 |
assert(FALSE); |
| 403 |
} |
| 404 |
|
| 405 |
+/* finds floor space on level with buildaux not equal to baux, |
| 406 |
+sets x,y there. Return false is no such space exists on the level. */ |
| 407 |
+int try_findspace (int * x_out, int * y_out, int baux) |
| 408 |
+{ |
| 409 |
+ /* try to quickly find a space by sampling randomly */ |
| 410 |
+ if (findspace_method_one(x_out, y_out, Level, baux)) |
| 411 |
+ return TRUE; |
| 412 |
+ |
| 413 |
+ /* examine every space on the level */ |
| 414 |
+ if (findspace_method_two(x_out, y_out, Level, baux)) |
| 415 |
+ return TRUE; |
| 416 |
+ |
| 417 |
+ return FALSE; |
| 418 |
+} |
| 419 |
+ |
| 420 |
/* is prefix a prefix of s? */ |
| 421 |
int strprefix(char *prefix, char *s) |
| 422 |
{ |
| 423 |
--- omega-rpg-0.90-pa9.orig/mon.c |
| 424 |
+++ omega-rpg-0.90-pa9/mon.c |
| 425 |
@@ -696,7 +696,7 @@ |
| 426 |
status = 2; |
| 427 |
strcpy(Str2,"Malaprop the Misnamed"); |
| 428 |
|
| 429 |
- strcpy(Str1,Omegalib); |
| 430 |
+ strcpy(Str1,Omegavar); |
| 431 |
strcat(Str1,"omega.log"); |
| 432 |
fd = checkfopen(Str1,"r"); |
| 433 |
n = 1; |
| 434 |
--- omega-rpg-0.90-pa9.orig/save.c |
| 435 |
+++ omega-rpg-0.90-pa9/save.c |
| 436 |
@@ -336,7 +336,7 @@ |
| 437 |
} |
| 438 |
mask >>= 1; |
| 439 |
if (level->site[i][j].lstatus&SEEN) |
| 440 |
- mask |= (1<<(sizeof(long int)*8 - 1)); |
| 441 |
+ mask |= (1UL<<(sizeof(long int)*8 - 1)); |
| 442 |
run--; |
| 443 |
} |
| 444 |
if (run < 8*sizeof(long int)) |
| 445 |
@@ -477,7 +477,7 @@ |
| 446 |
} |
| 447 |
mask >>= 1; |
| 448 |
if (c_statusp(i, j, SEEN)) |
| 449 |
- mask |= (1<<(sizeof(long int)*8 - 1)); |
| 450 |
+ mask |= (1UL<<(sizeof(long int)*8 - 1)); |
| 451 |
run--; |
| 452 |
} |
| 453 |
if (run < 8*sizeof(long int)) |
| 454 |
--- omega-rpg-0.90-pa9.orig/extern.h |
| 455 |
+++ omega-rpg-0.90-pa9/extern.h |
| 456 |
@@ -1126,6 +1126,7 @@ |
| 457 |
void do_los( Symbol,int *,int *,int,int ); |
| 458 |
void do_object_los (Symbol, int *, int *, int, int); |
| 459 |
void findspace( int *,int *,int ); |
| 460 |
+int try_findspace( int *,int *,int ); |
| 461 |
void initdirs( void ); |
| 462 |
#ifdef NO_USLEEP |
| 463 |
void usleep( int ); |
| 464 |
--- omega-rpg-0.90-pa9.orig/defs.h |
| 465 |
+++ omega-rpg-0.90-pa9/defs.h |
| 466 |
@@ -71,7 +71,8 @@ |
| 467 |
This might usually be "/usr/games/lib/omegalib/", for unix, |
| 468 |
or something like "c:\\games\\omega\\omegalib\\" for msdos */ |
| 469 |
|
| 470 |
-#define OMEGALIB "./lib/" |
| 471 |
+#define OMEGALIB "/usr/share/games/omega-rpg/" |
| 472 |
+#define OMEGAVAR "/var/games/omega-rpg/" |
| 473 |
|
| 474 |
/* TILEFILE is the name of the file you want to use for graphics tiles. You */ |
| 475 |
/* aren't really free to use any file you want here. It should be the Omega */ |
| 476 |
@@ -93,7 +94,7 @@ |
| 477 |
|
| 478 |
/* set WIZARD to maintainers's username */ |
| 479 |
|
| 480 |
-#define WIZARD "sheldon" |
| 481 |
+#define WIZARD "root" |
| 482 |
|
| 483 |
/* If CATCH_SIGNALS is set to 1, will not dump core, nicer for players. */ |
| 484 |
/* dbx still intercepts the signals first, so it's ok for debugging */ |
| 485 |
--- omega-rpg-0.90-pa9.orig/glob.h |
| 486 |
+++ omega-rpg-0.90-pa9/glob.h |
| 487 |
@@ -26,6 +26,9 @@ |
| 488 |
/* This string holds the path to the library files */ |
| 489 |
extern char *Omegalib; |
| 490 |
|
| 491 |
+/* This string holds the path to the highscore and log files */ |
| 492 |
+extern char *Omegavar; |
| 493 |
+ |
| 494 |
/* one of each monster */ |
| 495 |
extern struct monster Monsters[NUMMONSTERS]; |
| 496 |
|
| 497 |
--- omega-rpg-0.90-pa9.orig/city.c |
| 498 |
+++ omega-rpg-0.90-pa9/city.c |
| 499 |
@@ -543,18 +543,15 @@ |
| 500 |
void resurrect_guards(void) |
| 501 |
{ |
| 502 |
int i,j; |
| 503 |
- char site; |
| 504 |
+ map *city; |
| 505 |
|
| 506 |
- FILE *fd; |
| 507 |
- |
| 508 |
- strcpy(Str3,Omegalib); |
| 509 |
- strcat(Str3,"city.dat"); |
| 510 |
- fd = checkfopen(Str3,"rb"); |
| 511 |
- site = cryptkey("city.dat"); |
| 512 |
+ /* Get the original city. */ |
| 513 |
+ city = map_open(MAP_city); |
| 514 |
+ map_setLevel(city,0); |
| 515 |
+ |
| 516 |
for(j=0;j<Level->level_length;j++) { |
| 517 |
for(i=0;i<Level->level_width;i++) { |
| 518 |
- site = getc(fd)^site; |
| 519 |
- if (site == 'G') { |
| 520 |
+ if (map_getSiteChar(city,i,j) == 'G') { |
| 521 |
make_site_monster(i,j,GUARD); |
| 522 |
Level->site[i][j].creature->monstring = "undead guardsman"; |
| 523 |
Level->site[i][j].creature->meleef = M_MELEE_SPIRIT; |
| 524 |
@@ -569,9 +566,7 @@ |
| 525 |
m_status_set(Level->site[i][j].creature,AWAKE); |
| 526 |
} |
| 527 |
} |
| 528 |
- site = getc(fd)^site; |
| 529 |
} |
| 530 |
- fclose(fd); |
| 531 |
} |
| 532 |
|
| 533 |
|
| 534 |
--- omega-rpg-0.90-pa9.orig/inv.c |
| 535 |
+++ omega-rpg-0.90-pa9/inv.c |
| 536 |
@@ -78,7 +78,7 @@ |
| 537 |
may drop things back onto the now null ground */ |
| 538 |
void pickup_at (int x, int y) |
| 539 |
{ |
| 540 |
- char response; |
| 541 |
+ char response = 0; |
| 542 |
|
| 543 |
pol ol; |
| 544 |
pol temp; |
| 545 |
@@ -90,10 +90,10 @@ |
| 546 |
|
| 547 |
while (ol != 0) |
| 548 |
{ |
| 549 |
- clearmsg1(); |
| 550 |
- response = cinema_ynq(strjoin("Pick up: ", itemid(ol->thing))); |
| 551 |
- if ('q' == response) |
| 552 |
- break; |
| 553 |
+ if(response != 'q') { |
| 554 |
+ clearmsg1(); |
| 555 |
+ response = cinema_ynq(strjoin("Pick up: ", itemid(ol->thing))); |
| 556 |
+ } |
| 557 |
|
| 558 |
if (response == 'y') |
| 559 |
gain_item(ol->thing); |
| 560 |
@@ -106,15 +106,6 @@ |
| 561 |
temp->thing = 0; |
| 562 |
free(temp); |
| 563 |
} |
| 564 |
- |
| 565 |
- while (ol != 0) |
| 566 |
- { |
| 567 |
- temp = ol; |
| 568 |
- ol = ol->next; |
| 569 |
- temp->next = 0; |
| 570 |
- temp->thing = 0; |
| 571 |
- free(temp); |
| 572 |
- } |
| 573 |
} |
| 574 |
|
| 575 |
/* WDT -- convert from a char (keypress) to an item index in |
| 576 |
@@ -553,7 +544,7 @@ |
| 577 |
|
| 578 |
int getitem_prompt (char * prompt, Symbol itype) |
| 579 |
{ |
| 580 |
- char key; |
| 581 |
+ int key; |
| 582 |
char *line3; |
| 583 |
char invstr[64]; |
| 584 |
char selectstr[80]; |
| 585 |
--- omega-rpg-0.90-pa9.orig/bank.c |
| 586 |
+++ omega-rpg-0.90-pa9/bank.c |
| 587 |
@@ -1142,6 +1142,9 @@ |
| 588 |
int num_accounts; |
| 589 |
bank_account *account; |
| 590 |
|
| 591 |
+ if(!bank) |
| 592 |
+ return 0; |
| 593 |
+ |
| 594 |
num_accounts = 0; |
| 595 |
for (account = bank; account; account = account->next_account) |
| 596 |
{ |
| 597 |
--- omega-rpg-0.90-pa9.orig/command3.c |
| 598 |
+++ omega-rpg-0.90-pa9/command3.c |
| 599 |
@@ -206,15 +206,13 @@ |
| 600 |
xredraw(); |
| 601 |
} |
| 602 |
|
| 603 |
-extern const char * LAST_OMEGA_BUILD_TIME; |
| 604 |
- |
| 605 |
void version(void) |
| 606 |
{ |
| 607 |
setgamestatus(SKIP_MONSTERS); |
| 608 |
print3(VERSIONSTRING); |
| 609 |
nprint3(":"); |
| 610 |
nprint3(" build date: "); |
| 611 |
- nprint3((char *)LAST_OMEGA_BUILD_TIME); |
| 612 |
+ nprint3(__DATE__" "__TIME__); |
| 613 |
} |
| 614 |
|
| 615 |
void fire(void) |
| 616 |
--- omega-rpg-0.90-pa9.orig/Makefile |
| 617 |
+++ omega-rpg-0.90-pa9/Makefile |
| 618 |
@@ -1,17 +1,17 @@ |
| 619 |
### These two definitions are used if you 'make install' |
| 620 |
### the value of LIBDIR should be the same as OMEGALIB in defs.h |
| 621 |
-BINDIR = ./omega/ |
| 622 |
-LIBDIR = ./lib/ |
| 623 |
+BINDIR = $(DESTDIR)/usr/games |
| 624 |
+LIBDIR = $(DESTDIR)/usr/share/games/omega-rpg |
| 625 |
|
| 626 |
### choose your optimization level |
| 627 |
-OFLAGS = -O2 |
| 628 |
+OFLAGS = -O2 -pipe |
| 629 |
|
| 630 |
### One of these should be uncommented, as appropriate, unless your compiler |
| 631 |
### does it for you. You can test this by simply trying to 'make' omega - |
| 632 |
### it will fail if none of them are defined. If you do uncomment |
| 633 |
### one, make sure you comment out the other definition of CFLAGS lower down |
| 634 |
|
| 635 |
-CFLAGS = -ggdb -Wall $(OFLAGS) -DBSD # -ansi |
| 636 |
+CFLAGS = -Wall $(OFLAGS) -DBSD # -ansi |
| 637 |
#CFLAGS = -DSYSV $(OFLAGS) |
| 638 |
#CFLAGS = -DMSDOS $(OFLAGS) |
| 639 |
#CFLAGS = -DAMIGA $(OFLAGS) |
| 640 |
@@ -30,15 +30,15 @@ |
| 641 |
#LIBS = -lcurses -ltermlib |
| 642 |
#LIBS = -lpdcurses |
| 643 |
#Linux links in term?? automatically. |
| 644 |
-#LIBS = -lncurses |
| 645 |
+LIBS = -lncurses |
| 646 |
|
| 647 |
### uncomment to use "op-curses" package |
| 648 |
-OPDEF = -DUSE_OPCURSES |
| 649 |
-CUROBJ = ../opcurses/curses.o ../opcurses/curgtk.o |
| 650 |
+#OPDEF = -DUSE_OPCURSES |
| 651 |
+#CUROBJ = ../opcurses/curses.o ../opcurses/curgtk.o |
| 652 |
|
| 653 |
### uncomment to compile using opcurses GTK+ driver |
| 654 |
-CPPFLAGS = `gtk-config --cflags` -DUSE_OPCURSES |
| 655 |
-LDFLAGS = `gtk-config --libs` |
| 656 |
+#CPPFLAGS = `gtk-config --cflags` -DUSE_OPCURSES |
| 657 |
+#LDFLAGS = `gtk-config --libs` |
| 658 |
|
| 659 |
#################### that's it for changing the Makefile #################### |
| 660 |
|
| 661 |
@@ -49,7 +49,7 @@ |
| 662 |
CLROBJ = clrgen.o |
| 663 |
|
| 664 |
OBJ = omega.o abyss.o aux1.o aux2.o aux3.o bank.o char.o city.o\ |
| 665 |
- command1.o command2.o command3.o country.o date.o effect1.o\ |
| 666 |
+ command1.o command2.o command3.o country.o effect1.o\ |
| 667 |
effect2.o effect3.o etc.o env.o file.o gen1.o gen2.o guild1.o guild2.o\ |
| 668 |
house.o init.o inv.o item.o itemf1.o itemf2.o itemf3.o lev.o map.o\ |
| 669 |
mmelee.o mmove.o mon.o move.o movef.o mspec.o mstrike.o mtalk.o\ |
| 670 |
@@ -60,7 +60,7 @@ |
| 671 |
|
| 672 |
omega: $(CUROBJ) $(CLROBJ) $(OBJ) |
| 673 |
$(CC) $(LDFLAGS) $(OFLAGS) $(CUROBJ) $(CLROBJ) $(OBJ) $(LIBS) -o omega |
| 674 |
- rm date.c date.o |
| 675 |
+ #rm date.c date.o |
| 676 |
|
| 677 |
date.c: |
| 678 |
tools/makedate > date.c |
| 679 |
@@ -70,26 +70,29 @@ |
| 680 |
cd tools/libsrc; make maps.dat |
| 681 |
|
| 682 |
install: omega maps.dat $(BINDIR) $(LIBDIR) |
| 683 |
- cp omega $(BINDIR) |
| 684 |
- chmod 4711 $(BINDIR)/omega |
| 685 |
+ cp omega $(BINDIR)/omega-rpg |
| 686 |
+ chmod 4711 $(BINDIR)/omega-rpg |
| 687 |
- cp lib/* $(LIBDIR) |
| 688 |
- cp maps.dat $(LIBDIR) |
| 689 |
+ cp lib/maps.dat $(LIBDIR) |
| 690 |
chmod 0644 $(LIBDIR)/help*.txt $(LIBDIR)/license.txt $(LIBDIR)/motd.txt $(LIBDIR)/thanks.txt $(LIBDIR)/update.txt |
| 691 |
chmod 0600 $(LIBDIR)/abyss.txt $(LIBDIR)/scroll[1234].txt $(LIBDIR)/maps.dat |
| 692 |
- chmod 0600 $(LIBDIR)/omega.hi $(LIBDIR)/omega.log $(LIBDIR)/omegahi.bak |
| 693 |
+ chmod 0600 $(LIBDIR)/omega.hi $(LIBDIR)/omega.log $(LIBDIR)/omega.hi.backup |
| 694 |
|
| 695 |
install_not_suid: omega maps.dat $(BINDIR) $(LIBDIR) |
| 696 |
- cp omega $(BINDIR) |
| 697 |
- chmod 0711 $(BINDIR)/omega |
| 698 |
+ cp omega $(BINDIR)/omega-rpg |
| 699 |
+ chmod 0711 $(BINDIR)/omega-rpg |
| 700 |
- cp lib/* $(LIBDIR) |
| 701 |
cp maps.dat $(LIBDIR) |
| 702 |
chmod 0644 $(LIBDIR)/help*.txt $(LIBDIR)/license.txt $(LIBDIR)/motd.txt $(LIBDIR)/thanks.txt $(LIBDIR)/update.txt |
| 703 |
chmod 0644 $(LIBDIR)/abyss.txt $(LIBDIR)/scroll[1234].txt $(LIBDIR)/*.dat |
| 704 |
chmod 0666 $(LIBDIR)/omega.hi $(LIBDIR)/omega.log |
| 705 |
- chmod 0600 $(LIBDIR)/omegahi.bak |
| 706 |
+ chmod 0600 $(LIBDIR)/omega.hi.backup |
| 707 |
|
| 708 |
clean: |
| 709 |
- rm -f $(OBJ) clrgen.h clrgen.c genclr.o genclr omega |
| 710 |
+ rm -f $(OBJ) $(CLROBJ) clrgen.h clrgen.c genclr.o genclr omega |
| 711 |
+ cd tools; $(MAKE) clean |
| 712 |
+ cd tools/libsrc; $(MAKE) clean |
| 713 |
+ cd lib; $(MAKE) clean |
| 714 |
|
| 715 |
distclean: |
| 716 |
rm -f $(OBJ) $(CUROBJ) $(TOOLS) $(OLIBSTUFF) clrgen.h clrgen.c genclr.o genclr omega |
| 717 |
@@ -98,12 +101,13 @@ |
| 718 |
|
| 719 |
$(CUROBJ): ../opcurses/curses.h ../opcurses/cmacros.h ../opcurses/xcurses.h |
| 720 |
|
| 721 |
-$(CLROBJ): clrgen.h |
| 722 |
+$(CLROBJ): clrgen.c |
| 723 |
|
| 724 |
$(OBJ): defs.h extern.h glob.h iinit.h minit.h clrgen.h |
| 725 |
|
| 726 |
-clrgen.h clrgen.c: genclr.c minit.h defs.h |
| 727 |
- $(MAKE) genclr |
| 728 |
+clrgen.c: clrgen.h |
| 729 |
+ |
| 730 |
+clrgen.h: genclr minit.h defs.h |
| 731 |
$(CPP) $(OPDEF) -DOMEGA_CLRGEN *.[ch] | ./genclr clrgen.c clrgen.h |
| 732 |
|
| 733 |
genclr: genclr.o |
| 734 |
--- omega-rpg-0.90-pa9.orig/effect1.c |
| 735 |
+++ omega-rpg-0.90-pa9/effect1.c |
| 736 |
@@ -80,11 +80,11 @@ |
| 737 |
} |
| 738 |
} |
| 739 |
else { |
| 740 |
- if (Player.possessions[i]->plus > random_range(20)+1) { |
| 741 |
+ if (abs(Player.possessions[i]->plus) > random_range(20)+1) { |
| 742 |
print1("Uh-oh, the force of the enchantment was too much!"); |
| 743 |
print2("There is a loud explosion!"); |
| 744 |
morewait(); |
| 745 |
- manastorm(Player.x,Player.y,Player.possessions[i]->plus*5); |
| 746 |
+ manastorm(Player.x,Player.y,abs(Player.possessions[i]->plus)*5); |
| 747 |
dispose_lost_objects(1,Player.possessions[i]); |
| 748 |
} |
| 749 |
else { |
| 750 |
@@ -382,6 +382,9 @@ |
| 751 |
for(i=0;i<9;i++) { |
| 752 |
ex = xx + Dirs[0][i]; |
| 753 |
ey = yy + Dirs[1][i]; |
| 754 |
+ |
| 755 |
+ if(offscreen(ex, ey)) |
| 756 |
+ continue; |
| 757 |
|
| 758 |
if ((ex == Player.x) && (ey == Player.y)) { |
| 759 |
switch(dtype) { |
| 760 |
--- omega-rpg-0.90-pa9.orig/tools/libsrc/Makefile |
| 761 |
+++ omega-rpg-0.90-pa9/tools/libsrc/Makefile |
| 762 |
@@ -9,3 +9,6 @@ |
| 763 |
|
| 764 |
../crypt: ../crypt.c |
| 765 |
cd ..; make |
| 766 |
+ |
| 767 |
+clean: |
| 768 |
+ rm -f maps.dat ../crypt |
| 769 |
--- omega-rpg-0.90-pa9.orig/lib/Makefile |
| 770 |
+++ omega-rpg-0.90-pa9/lib/Makefile |
| 771 |
@@ -10,3 +10,6 @@ |
| 772 |
.map.dat: |
| 773 |
cd ../tools; make -f makefile |
| 774 |
../tools/crypt $@ > $@ < $< |
| 775 |
+ |
| 776 |
+clean: |
| 777 |
+ rm -f .maps.dat maps.dat |
| 778 |
--- omega-rpg-0.90-pa9.orig/lib/motd.txt |
| 779 |
+++ omega-rpg-0.90-pa9/lib/motd.txt |
| 780 |
@@ -9,7 +9,7 @@ |
| 781 |
* ** ** * |
| 782 |
***** ***** |
| 783 |
|
| 784 |
- omega version 0.90-pa8 is copyright (C) 1987,1988,1989 by: |
| 785 |
+ omega version 0.90-pa9 is copyright (C) 1987,1988,1989 by: |
| 786 |
Laurence R. Brothers |
| 787 |
and is licensed under the LGPL. |
| 788 |
Maintained by: William Tanksley ([email protected]). |