<Someone>'s gem changes.
This commit is contained in:
@@ -37,7 +37,7 @@ void get_colors(int handle, short *palette, int col){
|
||||
if(i<16)
|
||||
idx=vdi2dev4[i];
|
||||
else
|
||||
idx=i;
|
||||
idx= i==255 ? 1 : i;
|
||||
}
|
||||
vq_color(handle, i, 0, (int *)palette + idx * 3);
|
||||
}
|
||||
@@ -49,7 +49,7 @@ void img_set_colors(int handle, short *palette, int col){
|
||||
/* set color palette */
|
||||
end=min(1<<col,1<<planes);
|
||||
for(i=0; i<end; i++){
|
||||
switch(col){
|
||||
switch(planes){ /* MAR -- war col 10.01.2001 */
|
||||
case 1:
|
||||
idx=i;break;
|
||||
case 2:
|
||||
@@ -60,7 +60,7 @@ void img_set_colors(int handle, short *palette, int col){
|
||||
if(i<16)
|
||||
idx=vdi2dev4[i];
|
||||
else
|
||||
idx=i;
|
||||
idx= i==255 ? 1 : i;
|
||||
}
|
||||
vs_color(handle, i, (int *)palette + idx * 3);
|
||||
}
|
||||
@@ -239,7 +239,6 @@ int depack_img(char *name, IMG_header *pic){
|
||||
/* ensure that lines aren't repeated past the end of the img */
|
||||
if(line + scan_repeat > pic->img_h)
|
||||
scan_repeat = pic->img_h - line;
|
||||
|
||||
/* copy line to image buffer */
|
||||
if(scan_repeat>1){
|
||||
/* calculate address of a current line in a current bitplane */
|
||||
|
||||
274
win/gem/wingem.c
274
win/gem/wingem.c
@@ -21,13 +21,28 @@ static int curr_status_line;
|
||||
static char *FDECL(copy_of, (const char *));
|
||||
static void FDECL(bail, (const char *)); /* __attribute__((noreturn)) */
|
||||
|
||||
extern int mar_set_tile_mode(int);
|
||||
extern void mar_set_font(int,const char*,int);
|
||||
extern void mar_set_margin(int);
|
||||
extern void mar_set_msg_visible(int);
|
||||
extern void mar_set_status_align(int);
|
||||
extern void mar_set_msg_align(int);
|
||||
extern void mar_set_tilefile(char *);
|
||||
extern void mar_set_tilex(int);
|
||||
extern void mar_set_tiley(int);
|
||||
extern short glyph2tile[MAX_GLYPH]; /* from tile.c */
|
||||
extern void mar_display_nhwindow(winid); /* from wingem1.c */
|
||||
|
||||
void Gem_outrip(winid,int);
|
||||
void Gem_preference_update(const char *);
|
||||
/* Interface definition, for windows.c */
|
||||
struct window_procs Gem_procs = {
|
||||
"Gem",
|
||||
WC_COLOR|WC_HILITE_PET|WC_INVERSE,
|
||||
WC_COLOR|WC_HILITE_PET|WC_ALIGN_MESSAGE|WC_ALIGN_STATUS|
|
||||
WC_INVERSE|WC_SCROLL_MARGIN|
|
||||
WC_FONT_MESSAGE|WC_FONT_STATUS|WC_FONT_MENU|WC_FONT_TEXT|WC_FONT_MAP|
|
||||
WC_FONTSIZ_MESSAGE|WC_FONTSIZ_STATUS|WC_FONTSIZ_MENU|WC_FONTSIZ_TEXT|WC_FONTSIZ_MAP|
|
||||
WC_TILE_WIDTH|WC_TILE_HEIGHT|WC_TILE_FILE|WC_VARY_MSGCOUNT|WC_ASCII_MAP,
|
||||
Gem_init_nhwindows,
|
||||
Gem_player_selection,
|
||||
Gem_askname,
|
||||
@@ -80,8 +95,8 @@ struct window_procs Gem_procs = {
|
||||
/* other defs that really should go away (they're tty specific) */
|
||||
Gem_start_screen,
|
||||
Gem_end_screen,
|
||||
genl_outrip,
|
||||
genl_preference_update
|
||||
Gem_outrip,
|
||||
Gem_preference_update
|
||||
};
|
||||
|
||||
#ifdef MAC
|
||||
@@ -117,6 +132,11 @@ mar_get_msg_history()
|
||||
return(iflags.msg_history);
|
||||
}
|
||||
|
||||
int
|
||||
mar_get_msg_visible()
|
||||
{
|
||||
return(iflags.wc_vary_msgcount);
|
||||
}
|
||||
/* clean up and quit */
|
||||
static void
|
||||
bail(mesg)
|
||||
@@ -128,6 +148,17 @@ const char *mesg;
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
/*$$$*/
|
||||
#define DEF_CLIPAROUND_MARGIN -1
|
||||
#ifndef TILE_X
|
||||
#define TILE_X 16
|
||||
#endif
|
||||
#define TILE_Y 16
|
||||
#define TILES_PER_LINE 20
|
||||
#define NHFONT_DEFAULT_SIZE 10
|
||||
#define NHFONT_SIZE_MIN 3
|
||||
#define NHFONT_SIZE_MAX 20
|
||||
/*$$$*/
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
Gem_init_nhwindows(argcp,argv)
|
||||
@@ -137,6 +168,42 @@ char** argv;
|
||||
argv=argv, argcp=argcp;
|
||||
colors_changed=TRUE;
|
||||
|
||||
set_wc_option_mod_status(
|
||||
WC_ALIGN_MESSAGE |
|
||||
WC_ALIGN_STATUS |
|
||||
WC_TILE_WIDTH |
|
||||
WC_TILE_HEIGHT |
|
||||
WC_TILE_FILE,
|
||||
DISP_IN_GAME);
|
||||
set_wc_option_mod_status(
|
||||
WC_HILITE_PET |
|
||||
WC_SCROLL_MARGIN |
|
||||
WC_FONT_MESSAGE |
|
||||
WC_FONT_MAP |
|
||||
WC_FONT_STATUS |
|
||||
WC_FONT_MENU |
|
||||
WC_FONT_TEXT |
|
||||
WC_FONTSIZ_MESSAGE |
|
||||
WC_FONTSIZ_MAP |
|
||||
WC_FONTSIZ_STATUS |
|
||||
WC_FONTSIZ_MENU |
|
||||
WC_FONTSIZ_TEXT |
|
||||
WC_VARY_MSGCOUNT,
|
||||
SET_IN_GAME
|
||||
);
|
||||
if( iflags.wc_align_message==0 ) iflags.wc_align_message = ALIGN_TOP;
|
||||
if( iflags.wc_align_status==0 ) iflags.wc_align_status = ALIGN_BOTTOM;
|
||||
if( iflags.wc_scroll_margin==0 ) iflags.wc_scroll_margin = DEF_CLIPAROUND_MARGIN;
|
||||
if( iflags.wc_tile_width==0 ) iflags.wc_tile_width = TILE_X;
|
||||
if( iflags.wc_tile_height==0 ) iflags.wc_tile_height = TILE_Y;
|
||||
if(iflags.wc_tile_file && *iflags.wc_tile_file)
|
||||
mar_set_tilefile(iflags.wc_tile_file);
|
||||
if( iflags.wc_vary_msgcount==0 ) iflags.wc_vary_msgcount = 3;
|
||||
mar_set_tile_mode(!iflags.wc_ascii_map); /* MAR -- 17.Mar 2002 True is tiles */
|
||||
mar_set_tilex(iflags.wc_tile_width);
|
||||
mar_set_tiley(iflags.wc_tile_height);
|
||||
mar_set_msg_align(iflags.wc_align_message-ALIGN_BOTTOM);
|
||||
mar_set_status_align(iflags.wc_align_status-ALIGN_BOTTOM);
|
||||
if(mar_gem_init()==0){
|
||||
bail((char *)0);
|
||||
/*NOTREACHED*/
|
||||
@@ -164,9 +231,14 @@ Gem_player_selection()
|
||||
|
||||
/* Should we randomly pick for the player? */
|
||||
if (!flags.randomall &&
|
||||
(flags.initrole == ROLE_NONE || flags.initrace == ROLE_NONE ||
|
||||
(flags.initrole == ROLE_NONE || flags.initrace == ROLE_NONE ||
|
||||
flags.initgend == ROLE_NONE || flags.initalign == ROLE_NONE)) {
|
||||
pick4u = yn_function("Shall I pick a character for you? [ynq]",ynqchars,'n');
|
||||
/* pick4u = yn_function("Shall I pick a character for you? [ynq]",ynqchars,'n');*/
|
||||
pick4u = yn_function(
|
||||
build_plselection_prompt(pbuf, QBUFSZ, flags.initrole,flags.initrace,
|
||||
flags.initgend, flags.initalign)
|
||||
,ynqchars,'n'
|
||||
);
|
||||
if(pick4u=='q'){
|
||||
give_up: /* Just quit */
|
||||
if (selected) free((genericptr_t) selected);
|
||||
@@ -260,7 +332,6 @@ give_up: /* Just quit */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Permit the user to pick, if there is more than one */
|
||||
if (n > 1) {
|
||||
win = create_nhwindow(NHW_MENU);
|
||||
@@ -289,7 +360,6 @@ give_up: /* Just quit */
|
||||
destroy_nhwindow(win);
|
||||
if (n != 1 || selected[0].item.a_int == any.a_int)
|
||||
goto give_up; /* Selected quit */
|
||||
|
||||
k = selected[0].item.a_int - 1;
|
||||
free((genericptr_t) selected), selected = 0;
|
||||
}
|
||||
@@ -330,7 +400,6 @@ give_up: /* Just quit */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Permit the user to pick, if there is more than one */
|
||||
if (n > 1) {
|
||||
win = create_nhwindow(NHW_MENU);
|
||||
@@ -360,7 +429,6 @@ give_up: /* Just quit */
|
||||
destroy_nhwindow(win);
|
||||
if (n != 1 || selected[0].item.a_int == any.a_int)
|
||||
goto give_up; /* Selected quit */
|
||||
|
||||
k = selected[0].item.a_int - 1;
|
||||
free((genericptr_t) selected), selected = 0;
|
||||
}
|
||||
@@ -400,7 +468,6 @@ give_up: /* Just quit */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Permit the user to pick, if there is more than one */
|
||||
if (n > 1) {
|
||||
win = create_nhwindow(NHW_MENU);
|
||||
@@ -433,7 +500,6 @@ give_up: /* Just quit */
|
||||
destroy_nhwindow(win);
|
||||
if (n != 1 || selected[0].item.a_int == any.a_int)
|
||||
goto give_up; /* Selected quit */
|
||||
|
||||
k = selected[0].item.a_int - 1;
|
||||
free((genericptr_t) selected), selected = 0;
|
||||
}
|
||||
@@ -649,6 +715,8 @@ Gem_putstr(window, attr, str)
|
||||
Gem_putstr(WIN_MESSAGE,0,str);
|
||||
else
|
||||
mar_map_curs_weiter();
|
||||
mar_display_nhwindow(WIN_MESSAGE);
|
||||
mar_display_nhwindow(WIN_STATUS);
|
||||
break;
|
||||
|
||||
case NHW_MENU:
|
||||
@@ -833,7 +901,6 @@ extern int mar_set_rogue(int);
|
||||
#endif
|
||||
|
||||
extern void mar_add_pet_sign(winid,int,int);
|
||||
extern int mar_set_tile_mode(int);
|
||||
|
||||
void
|
||||
Gem_print_glyph(window, x, y, glyph)
|
||||
@@ -851,10 +918,11 @@ Gem_print_glyph(window, x, y, glyph)
|
||||
x--; /* MAR -- because x ranges from 1 to COLNO */
|
||||
if(mar_set_tile_mode(-1)){
|
||||
mar_print_glyph(window,x,y,glyph2tile[glyph]);
|
||||
if(glyph_is_pet(glyph)
|
||||
if(
|
||||
#ifdef TEXTCOLOR
|
||||
&& iflags.hilite_pet
|
||||
iflags.hilite_pet &&
|
||||
#endif
|
||||
glyph_is_pet(glyph)
|
||||
)
|
||||
mar_add_pet_sign(window,x,y);
|
||||
}else
|
||||
@@ -868,7 +936,7 @@ void mar_print_gl_char(window, x, y, glyph)
|
||||
xchar x, y;
|
||||
int glyph;
|
||||
{
|
||||
uchar ch;
|
||||
int ch;
|
||||
int color;
|
||||
unsigned special;
|
||||
|
||||
@@ -978,6 +1046,182 @@ char *posbar;
|
||||
{}
|
||||
#endif
|
||||
|
||||
/** Gem_outrip **/
|
||||
void mar_set_text_to_rip(winid);
|
||||
char** rip_line=0;
|
||||
extern const char *killed_by_prefix[];
|
||||
void
|
||||
Gem_outrip(w, how)
|
||||
winid w;
|
||||
int how;
|
||||
{
|
||||
/* Code from X11 windowport */
|
||||
#define STONE_LINE_LEN 15 /* # chars that fit on one line */
|
||||
#define NAME_LINE 0 /* line # for player name */
|
||||
#define GOLD_LINE 1 /* line # for amount of gold */
|
||||
#define DEATH_LINE 2 /* line # for death description */
|
||||
#define YEAR_LINE 6 /* line # for year */
|
||||
char buf[BUFSZ];
|
||||
char *dpx;
|
||||
int line;
|
||||
if (!rip_line) {
|
||||
int i;
|
||||
rip_line= (char **)malloc((YEAR_LINE+1)*sizeof(char *));
|
||||
for (i=0; i<YEAR_LINE+1; i++) {
|
||||
rip_line[i]=(char *)malloc((STONE_LINE_LEN+1)*sizeof(char));
|
||||
}
|
||||
}
|
||||
/* Follows same algorithm as genl_outrip() */
|
||||
/* Put name on stone */
|
||||
Sprintf(rip_line[NAME_LINE], "%s", plname);
|
||||
/* Put $ on stone */
|
||||
Sprintf(rip_line[GOLD_LINE], "%ld Au",
|
||||
#ifndef GOLDOBJ
|
||||
u.ugold);
|
||||
#else
|
||||
done_money);
|
||||
#endif
|
||||
/* Put together death description */
|
||||
switch (killer_format) {
|
||||
default: impossible("bad killer format?");
|
||||
case KILLED_BY_AN:
|
||||
Strcpy(buf, killed_by_prefix[how]);
|
||||
Strcat(buf, an(killer));
|
||||
break;
|
||||
case KILLED_BY:
|
||||
Strcpy(buf, killed_by_prefix[how]);
|
||||
Strcat(buf, killer);
|
||||
break;
|
||||
case NO_KILLER_PREFIX:
|
||||
Strcpy(buf, killer);
|
||||
break;
|
||||
}
|
||||
/* Put death type on stone */
|
||||
for (line=DEATH_LINE, dpx = buf; line<YEAR_LINE; line++) {
|
||||
register int i,i0;
|
||||
char tmpchar;
|
||||
if ( (i0=strlen(dpx)) > STONE_LINE_LEN) {
|
||||
for(i = STONE_LINE_LEN;
|
||||
((i0 > STONE_LINE_LEN) && i); i--)
|
||||
if(dpx[i] == ' ') i0 = i;
|
||||
if(!i) i0 = STONE_LINE_LEN;
|
||||
}
|
||||
tmpchar = dpx[i0];
|
||||
dpx[i0] = 0;
|
||||
strcpy(rip_line[line], dpx);
|
||||
if (tmpchar != ' ') {
|
||||
dpx[i0] = tmpchar;
|
||||
dpx= &dpx[i0];
|
||||
} else dpx= &dpx[i0+1];
|
||||
}
|
||||
/* Put year on stone */
|
||||
Sprintf(rip_line[YEAR_LINE], "%4d", getyear());
|
||||
mar_set_text_to_rip(w);
|
||||
for(line=0;line<13;line++)
|
||||
putstr(w, 0, "");
|
||||
}
|
||||
void
|
||||
mar_get_font(type,p_fname,psize)
|
||||
int type;
|
||||
char **p_fname;
|
||||
int *psize;
|
||||
{
|
||||
switch(type){
|
||||
case NHW_MESSAGE:
|
||||
*p_fname=iflags.wc_font_message;
|
||||
*psize=iflags.wc_fontsiz_message;
|
||||
break;
|
||||
case NHW_MAP:
|
||||
*p_fname=iflags.wc_font_map;
|
||||
*psize=iflags.wc_fontsiz_map;
|
||||
break;
|
||||
case NHW_STATUS:
|
||||
*p_fname=iflags.wc_font_status;
|
||||
*psize=iflags.wc_fontsiz_status;
|
||||
break;
|
||||
case NHW_MENU:
|
||||
*p_fname=iflags.wc_font_menu;
|
||||
*psize=iflags.wc_fontsiz_menu;
|
||||
break;
|
||||
case NHW_TEXT:
|
||||
*p_fname=iflags.wc_font_text;
|
||||
*psize=iflags.wc_fontsiz_text;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
void
|
||||
Gem_preference_update(pref)
|
||||
const char *pref;
|
||||
{
|
||||
if( stricmp( pref, "font_message")==0 ||
|
||||
stricmp( pref, "font_size_message")==0 ) {
|
||||
if( iflags.wc_fontsiz_message<NHFONT_SIZE_MIN ||
|
||||
iflags.wc_fontsiz_message>NHFONT_SIZE_MAX )
|
||||
iflags.wc_fontsiz_message = NHFONT_DEFAULT_SIZE;
|
||||
mar_set_font(NHW_MESSAGE,iflags.wc_font_message,iflags.wc_fontsiz_message);
|
||||
return;
|
||||
}
|
||||
if( stricmp( pref, "font_map")==0 ||
|
||||
stricmp( pref, "font_size_map")==0 ) {
|
||||
if( iflags.wc_fontsiz_map<NHFONT_SIZE_MIN ||
|
||||
iflags.wc_fontsiz_map>NHFONT_SIZE_MAX )
|
||||
iflags.wc_fontsiz_map = NHFONT_DEFAULT_SIZE;
|
||||
mar_set_font(NHW_MAP,iflags.wc_font_map,iflags.wc_fontsiz_map);
|
||||
return;
|
||||
}
|
||||
if( stricmp( pref, "font_status")==0 ||
|
||||
stricmp( pref, "font_size_status")==0 ) {
|
||||
if( iflags.wc_fontsiz_status<NHFONT_SIZE_MIN ||
|
||||
iflags.wc_fontsiz_status>NHFONT_SIZE_MAX )
|
||||
iflags.wc_fontsiz_status = NHFONT_DEFAULT_SIZE;
|
||||
mar_set_font(NHW_STATUS,iflags.wc_font_status,iflags.wc_fontsiz_status);
|
||||
return;
|
||||
}
|
||||
if( stricmp( pref, "font_menu")==0 ||
|
||||
stricmp( pref, "font_size_menu")==0 ) {
|
||||
if( iflags.wc_fontsiz_menu<NHFONT_SIZE_MIN ||
|
||||
iflags.wc_fontsiz_menu>NHFONT_SIZE_MAX )
|
||||
iflags.wc_fontsiz_menu = NHFONT_DEFAULT_SIZE;
|
||||
mar_set_font(NHW_MENU,iflags.wc_font_menu,iflags.wc_fontsiz_menu);
|
||||
return;
|
||||
}
|
||||
if( stricmp( pref, "font_text")==0 ||
|
||||
stricmp( pref, "font_size_text")==0 ) {
|
||||
if( iflags.wc_fontsiz_text<NHFONT_SIZE_MIN ||
|
||||
iflags.wc_fontsiz_text>NHFONT_SIZE_MAX )
|
||||
iflags.wc_fontsiz_text = NHFONT_DEFAULT_SIZE;
|
||||
mar_set_font(NHW_TEXT,iflags.wc_font_text,iflags.wc_fontsiz_text);
|
||||
return;
|
||||
}
|
||||
if( stricmp( pref, "scroll_margin")==0 ) {
|
||||
mar_set_margin(iflags.wc_scroll_margin);
|
||||
Gem_cliparound(u.ux, u.uy);
|
||||
return;
|
||||
}
|
||||
if( stricmp( pref, "ascii_map")==0 ) {
|
||||
mar_set_tile_mode(!iflags.wc_ascii_map);
|
||||
doredraw();
|
||||
return;
|
||||
}
|
||||
if( stricmp( pref, "hilite_pet")==0 ){
|
||||
/* MAR -- works without doing something here. */
|
||||
return;
|
||||
}
|
||||
if( stricmp( pref, "align_message")==0){
|
||||
mar_set_msg_align(iflags.wc_align_message-ALIGN_BOTTOM);
|
||||
return;
|
||||
}
|
||||
if(stricmp( pref, "align_status")==0 ){
|
||||
mar_set_status_align(iflags.wc_align_status-ALIGN_BOTTOM);
|
||||
return;
|
||||
}
|
||||
if( stricmp( pref, "vary_msgcount")==0 ){
|
||||
mar_set_msg_visible(iflags.wc_vary_msgcount);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Allocate a copy of the given string. If null, return a string of
|
||||
* zero length.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1156,6 +1156,11 @@ int color;
|
||||
if (windowprocs.name != NULL &&
|
||||
!strcmpi(windowprocs.name, "X11")) return TRUE;
|
||||
#endif
|
||||
#ifdef GEM_GRAPHICS
|
||||
/* XXX has_color() should be added to windowprocs */
|
||||
if (windowprocs.name != NULL &&
|
||||
!strcmpi(windowprocs.name, "Gem")) return TRUE;
|
||||
#endif
|
||||
#ifdef AMII_GRAPHICS
|
||||
/* hilites[] not used */
|
||||
return iflags.use_color;
|
||||
|
||||
Reference in New Issue
Block a user