projects
/
super-star-trek.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
49483a1
)
More merge-down.
author
Eric S. Raymond
<esr@thyrsus.com>
Fri, 28 Jan 2005 22:00:45 +0000
(22:00 +0000)
committer
Eric S. Raymond
<esr@thyrsus.com>
Fri, 28 Jan 2005 22:00:45 +0000
(22:00 +0000)
moving.c
patch
|
blob
|
history
sst.c
patch
|
blob
|
history
diff --git
a/moving.c
b/moving.c
index 05c3d3ab95761cf83e570d13d7220b3d4aeed39c..c8947fe7590c95d5dc59e4cf262a4537326cfb61 100644
(file)
--- a/
moving.c
+++ b/
moving.c
@@
-1,3
+1,7
@@
+#ifdef SERGEEV
+#include <conio.h>
+#include "sstlinux.h"
+#endif /* SERGEEV */
#include <unistd.h>
#include "sst.h"
#include <unistd.h>
#include "sst.h"
@@
-51,7
+55,12
@@
void imove(void) {
(iy-game.ky[l])*(double)(iy-game.ky[l]));
game.kavgd[l] = 0.5 * (finald+game.kdist[l]);
}
(iy-game.ky[l])*(double)(iy-game.ky[l]));
game.kavgd[l] = 0.5 * (finald+game.kdist[l]);
}
+#ifdef SERGEEV
+ if (skill > 3 && klhere > 0 && game.state.galaxy[quadx][quady] != 1000)
+ attack(0);
+#else
if (game.state.galaxy[quadx][quady] != 1000) attack(0);
if (game.state.galaxy[quadx][quady] != 1000) attack(0);
+#endif /* SERGEEV */
if (alldone) return;
}
/* compute final position -- new quadrant and sector */
if (alldone) return;
}
/* compute final position -- new quadrant and sector */
@@
-89,9
+98,9
@@
void imove(void) {
finish(FNEG3);
return;
}
finish(FNEG3);
return;
}
-
prout("\nYOU HAVE ATTEMPTED TO CROSS THE NEGATIVE ENERGY BARRIER\n
"
-
"AT THE EDGE OF THE GALAXY. THE THIRD TIME YOU TRY THIS,\n
"
-
"YOU WILL BE DESTROYED.\n
");
+
prout("\n\rYOU HAVE ATTEMPTED TO CROSS THE NEGATIVE ENERGY BARRIER\n\r
"
+
"AT THE EDGE OF THE GALAXY. THE THIRD TIME YOU TRY THIS,\n\r
"
+
"YOU WILL BE DESTROYED.\n\r
");
}
/* Compute final position in new quadrant */
if (trbeam) return; /* Don't bother if we are to be beamed */
}
/* Compute final position in new quadrant */
if (trbeam) return; /* Don't bother if we are to be beamed */
@@
-897,7
+906,7
@@
void help(void) {
double ddist, xdist, probf;
int line = 0, l, ix, iy;
#ifdef SERGEEV
double ddist, xdist, probf;
int line = 0, l, ix, iy;
#ifdef SERGEEV
- int pox, posy;
+ int po
s
x, posy;
#endif /* SERGEEV */
chew();
#endif /* SERGEEV */
chew();
@@
-946,7
+955,6
@@
void help(void) {
proutn("");
crmshp();
prout(" dematerializes.");
proutn("");
crmshp();
prout(" dematerializes.");
-#ifdef SERGEEV
sectx=0;
for (l = 1; l <= 5; l++) {
ix = basex+3.0*Rand()-1;
sectx=0;
for (l = 1; l <= 5; l++) {
ix = basex+3.0*Rand()-1;
@@
-964,7
+972,6
@@
void help(void) {
finish(FMATERIALIZE);
return;
}
finish(FMATERIALIZE);
return;
}
-#endif /* SERGEEV */
/* Give starbase three chances to rematerialize starship */
probf = pow((1.0 - pow(0.98,ddist)), 0.33333333);
for (l = 1; l <= 3; l++) {
/* Give starbase three chances to rematerialize starship */
probf = pow((1.0 - pow(0.98,ddist)), 0.33333333);
for (l = 1; l <= 3; l++) {
diff --git
a/sst.c
b/sst.c
index b31200ecece75d2d857a83983d970aa208a57a35..5cba52ea154cc675bc71f5a390360149e9bd4756 100644
(file)
--- a/
sst.c
+++ b/
sst.c
@@
-1,6
+1,11
@@
#define INCLUDED // Define externs here
#include <ctype.h>
#include <getopt.h>
#define INCLUDED // Define externs here
#include <ctype.h>
#include <getopt.h>
+#ifdef SERGEEV
+#include <conio.h>
+#include <time.h>
+#include "sstlinux.h"
+#endif /* SERGEEV */
#include "sst.h"
#ifndef SSTDOC
#include "sst.h"
#ifndef SSTDOC
@@
-84,10
+89,19
@@
SERGEEV, not yet completely merged):
*/
static char *commands[] = {
*/
static char *commands[] = {
+#ifdef SERGEEV
+ "--",
+ "---",
+#else
"srscan",
"lrscan",
"srscan",
"lrscan",
+#endif /* SERGEEV */
"phasers",
"phasers",
+#ifdef SERGEEV
+ "torpedo",
+#else
"photons",
"photons",
+#endif /* SERGEEV */
"move",
"shields",
"dock",
"move",
"shields",
"dock",
@@
-96,40
+110,63
@@
static char *commands[] = {
"impulse",
"rest",
"warp",
"impulse",
"rest",
"warp",
+#ifdef SERGEEV
+ "score",
+ "----",
+#else
"status",
"sensors",
"status",
"sensors",
+#endif /* SERGEEV */
"orbit",
"transport",
"mine",
"crystals",
"shuttle",
"planets",
"orbit",
"transport",
"mine",
"crystals",
"shuttle",
"planets",
+#ifdef SERGEEV
+ "-----",
+#else
"request",
"request",
+#endif /* SERGEEV */
"report",
"computer",
"commands",
"report",
"computer",
"commands",
- "emexit",
- "probe",
+
"emexit",
+
"probe",
"abandon",
"destruct",
"abandon",
"destruct",
+#ifdef SERGEEV
+ "save",
+#else
"freeze",
"freeze",
+#endif /* SERGEEV */
"deathray",
"debug",
"deathray",
"debug",
+#ifdef SERGEEV
+ "sos",
+#else
"call",
"call",
+#endif /* SERGEEV */
"quit",
"help"
};
"quit",
"help"
};
+
+#ifdef SERGEEV
+wnd wnds[6]={{1,1,80,25},{1,1,25,12},{26,2,80,12},{65,1,80,10},{1,13,80,23},{1,24,80,25}};
+short curwnd;
+#endif /* SERGEEV */
+
#define NUMCOMMANDS sizeof(commands)/sizeof(commands[0])
static void listCommands(int x) {
#define NUMCOMMANDS sizeof(commands)/sizeof(commands[0])
static void listCommands(int x) {
-
prout(" SRSCAN MOVE PHASERS CALL\n
"
-
" STATUS IMPULSE PHOTONS ABANDON\n
"
-
" LRSCAN WARP SHIELDS DESTRUCT\n
"
-
" CHART REST DOCK QUIT\n
"
-
" DAMAGES REPORT SENSORS ORBIT\n
"
-
" TRANSPORT MINE CRYSTALS SHUTTLE\n
"
-
" PLANETS REQUEST DEATHRAY FREEZE\n
"
-
" COMPUTER EMEXIT PROBE COMMANDS
");
+
proutn ("LEGAL COMMANDS ARE:\n\r
"
+
" MOVE PHASERS SOS PROBE\n\r
"
+
" COMPUTER IMPULSE TORPEDO ABANDON\n\r
"
+
" EMEXIT WARP SHIELDS DESTRUCT\n\r
"
+
" CHART REST DOCK QUIT\n\r
"
+
" DAMAGES REPORT SCORE ORBIT\n\r
"
+
" TRANSPORT MINE CRYSTALS SHUTTLE\n\r
"
+
" PLANETS DEATHRAY SAVE COMMANDS\n\r
");
if (x) prout(" HELP");
}
if (x) prout(" HELP");
}
@@
-244,16
+281,39
@@
void drawmaps(short l){
static void makemoves(void) {
int i, hitme;
static void makemoves(void) {
int i, hitme;
+#ifdef SERGEEV
+ clrscr();
+ setwnd(4);
+#endif /* SERGEEV */
while (TRUE) { /* command loop */
while (TRUE) { /* command loop */
- hitme = FALSE;
- justin = 0;
- Time = 0.0;
- i = -1;
- while (TRUE) { /* get a command */
+#ifdef SERGEEV
+ drawmaps(1);
+#endif /* SERGEEV */
+ while (TRUE) { /* get a command */
+ hitme = FALSE;
+ justin = 0;
+ Time = 0.0;
+ i = -1;
chew();
chew();
- skip(1);
+#ifdef SERGEEV
+ setwnd(5);
+ clrscr();
+#endif /* SERGEEV */
proutn("COMMAND> ");
proutn("COMMAND> ");
- if (scan() == IHEOL) continue;
+#ifdef SERGEEV
+ if (scan() == IHEOL) {
+ _setcursortype(_NOCURSOR);
+ setwnd(4);
+ clrscr();
+ chart(0);
+ _setcursortype(_NORMALCURSOR);
+ continue;
+ }
+ ididit=0;
+ clrscr();
+ setwnd(4);
+ clrscr();
+#endif /* SERGEEV */
for (i=0; i < 26; i++)
if (isit(commands[i]))
break;
for (i=0; i < 26; i++)
if (isit(commands[i]))
break;
@@
-262,20
+322,18
@@
static void makemoves(void) {
if (strcmp(commands[i], citem) == 0) break;
if (i < NUMCOMMANDS) break;
if (strcmp(commands[i], citem) == 0) break;
if (i < NUMCOMMANDS) break;
- if (skill <= 2) {
- prout("UNRECOGNIZED COMMAND. LEGAL COMMANDS ARE:");
- listCommands(TRUE);
- }
- else prout("UNRECOGNIZED COMMAND.");
+ listCommands(TRUE);
}
commandhook(commands[i], TRUE);
switch (i) { /* command switch */
}
commandhook(commands[i], TRUE);
switch (i) { /* command switch */
- case 0: // srscan
- srscan(1);
- break;
- case 1: // lrscan
- lrscan();
- break;
+#ifndef SERGEEV
+ case 0: // srscan
+ srscan(1);
+ break;
+ case 1: // lrscan
+ lrscan();
+ break;
+#endif /* SERGEEV */
case 2: // phasers
phasers();
if (ididit) hitme = TRUE;
case 2: // phasers
phasers();
if (ididit) hitme = TRUE;
@@
-290,12
+348,12
@@
static void makemoves(void) {
case 5: // shields
doshield(1);
if (ididit) {
case 5: // shields
doshield(1);
if (ididit) {
-
attack(2)
;
+
hitme=TRUE
;
shldchg = 0;
}
break;
case 6: // dock
shldchg = 0;
}
break;
case 6: // dock
- dock(1);
+
dock(1);
if (ididit) attack(0);
break;
case 7: // damages
if (ididit) attack(0);
break;
case 7: // damages
@@
-314,12
+372,14
@@
static void makemoves(void) {
case 11: // warp
setwrp();
break;
case 11: // warp
setwrp();
break;
- case 12: // status
-
srscan(3
);
+ case 12: // score
+
score(
);
break;
break;
+#ifndef SERGEEV
case 13: // sensors
sensor();
break;
case 13: // sensors
sensor();
break;
+#endif /* SERGEEV */
case 14: // orbit
orbit();
if (ididit) hitme = TRUE;
case 14: // orbit
orbit();
if (ididit) hitme = TRUE;
@@
-333,6
+393,7
@@
static void makemoves(void) {
break;
case 17: // crystals
usecrystals();
break;
case 17: // crystals
usecrystals();
+ if (ididit) hitme = TRUE;
break;
case 18: // shuttle
shuttle();
break;
case 18: // shuttle
shuttle();
@@
-383,6
+444,7
@@
static void makemoves(void) {
break;
case 31: // Call for help
help();
break;
case 31: // Call for help
help();
+ if (ididit) hitme = TRUE;
break;
case 32:
alldone = 1; // quit the game
break;
case 32:
alldone = 1; // quit the game
@@
-474,8
+536,8
@@
int main(int argc, char **argv) {
#ifndef SERGEEV
ioend();
#endif /* SERGEEV */
#ifndef SERGEEV
ioend();
#endif /* SERGEEV */
- p
uts
("May the Great Bird of the Galaxy roost upon your home planet.");
-
exit(0)
;
+ p
rout
("May the Great Bird of the Galaxy roost upon your home planet.");
+
return 0
;
}
}