Ogre Under System 5
Perry Kivolowitz
perry at heurikon.UUCP
Wed Nov 14 11:13:46 AEST 1984
Kudos to Mike Caplinger for a fine implementation. Following is a modified
version of termcap.c which is the only file requiring changes for running
the distributed version of OGRE under system 5. One thing of note, our
System 5 implementation (from Unisoft) does not have a working [sg]tty
system subroutine. This is of no importance since the sgttyb structure is
not really the thing that must change under System 5 but rather the termio
structure.
At the suggestion of a friend, I have added a feature (probably not found
in the original game). That is, if an Infantry unit doesn't move for two
turns it can increase its defensive strength by one to a maximum of three.
If an Infantry unit (whose defensinve strength has been so increased)
moves, its defensive strength reduces to that of an ordinary Infantry
unit. This is meant to simulate the ability of dog-faces to ``dig in.'' I
have not found this new feature to make the game less challenging.
The changes to implement this feature are a few lines in move.c.
Also, I have added self-propelled guns which are similar to moving H's.
In addition to the modified termcap.c I have also included a modified ext.h
to resolve name-length problems.
--------------------------------------------------------------------------
#include <termio.h>
/*
Interface to termcap library.
*/
char PC;
char *BC, *UP;
char *eeolseq, *cmseq;
char *clearseq;
int putchar();
tc_setup() {
static char bp[1024];
static char buffer[1024];
char *area = buffer;
char *getenv();
char *tgetstr();
char *name;
int retcode;
name = getenv("TERM");
retcode = tgetent(bp, name);
switch(retcode) {
case -1:
printf("can't open termcap file.\n");
exit(1);
break;
case 0:
printf("No termcap entry for %s.\n", name);
exit(1);
break;
}
eeolseq = tgetstr("ce", &area);
cmseq = tgetstr("cm", &area);
clearseq = tgetstr("cl", &area);
BC = tgetstr("bc", &area);
UP = tgetstr("up", &area);
}
eeol() {
tputs(eeolseq, 0, putchar);
}
clear_screen() {
tputs(clearseq, 0, putchar);
}
movecur(row, col)
int row, col;
{
tputs(tgoto(cmseq, col, row), 0, putchar);
}
/* system 5 mods begin here (psk) */
struct termio old_term;
struct termio new_term;
/*
Set terminal to CBREAK and NOECHO.
*/
set_term() {
static int first = 1;
if(first) {
ioctl(0 , TCGETA , &new_term);
ioctl(0 , TCGETA , &old_term);
new_term.c_lflag &= ~(ECHO | ECHOE | ICANON);
new_term.c_lflag |= ISIG;
new_term.c_cc[4] = 1;
new_term.c_cc[5] = 0;
first = 0;
}
ioctl(0, TCSETA , &new_term);
}
/*
Reset the terminal to normal mode.
*/
reset_term() {
ioctl(0, TCSETA , &old_term);
}
__________________________________________________________________________
The following is a new ext.h for Mike Caplinger's OGRE implemenation. By
using this version one can avoid nasty duplicate definition messages under
System 5.
--------------------------------------------------------------------------
#include "ogre.h"
#ifdef MAIN
UNIT unit[N_UNITS];
OGRE ogre;
int n_units;
#else
extern UNIT unit[N_UNITS];
extern OGRE ogre;
extern int n_units;
#endif
/*
** gets rid of variable/routine name length problems. (psk)
*/
#define display DSP1
#define display_xy DSP2
#define display_range DSP3
#define disp_ogre DSP4
#define disp_ogre_status DSP5
#define init_ogre INIT1
#define init_ogre_attack INIT2
#define movecur_hex MV1
#define movecur_unit MV2
#define move_ogre MVOGR1
#define move_ogre1 MVOGR2
#define update_odds UPDT1
#define update_hex UPDT2
More information about the Comp.sources.unix
mailing list