summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-12 17:40:50 +0000
committerennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-12 17:40:50 +0000
commite8db28371cb0baab1b48f02b94d7dbfb1b6790bc (patch)
tree46878b84429fad7ebab72eab5aed3b8ddaf75b86 /crawl-ref/source
parent34c943ec7ac5c63bdf9325c19fece2581e897479 (diff)
downloadcrawl-ref-e8db28371cb0baab1b48f02b94d7dbfb1b6790bc.tar.gz
crawl-ref-e8db28371cb0baab1b48f02b94d7dbfb1b6790bc.zip
Fix tiles title screen issues on Win32.
Continuing tile code cleanup. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3257 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/guic-win.cc84
-rw-r--r--crawl-ref/source/guic.h36
-rw-r--r--crawl-ref/source/libgui.cc516
-rw-r--r--crawl-ref/source/rltiles/title.bmpbin173570 -> 174134 bytes
-rw-r--r--crawl-ref/source/tile2.cc28
5 files changed, 283 insertions, 381 deletions
diff --git a/crawl-ref/source/guic-win.cc b/crawl-ref/source/guic-win.cc
index 7624f44334..836b4116be 100644
--- a/crawl-ref/source/guic-win.cc
+++ b/crawl-ref/source/guic-win.cc
@@ -1,9 +1,7 @@
-// Windows ヘッダー ファイル:
#include <windows.h>
#include <commdlg.h>
#include <commctrl.h>
-// C ランタイム ヘッダー ファイル
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
@@ -34,7 +32,7 @@ bool GuicInit(HINSTANCE h, int nCmd)
for (i=0; i< MAX_TERM_COL; i++)
{
- int *c = (int *)&term_colors[i];
+ int *c = (int *)&term_colors[i];
term_pix[i] =PALETTERGB( c[0], c[1], c[2] );
}
return true;
@@ -115,8 +113,8 @@ void RegionClass::init_font(const char *name, int height)
if (!ftmp)
{
- if (font) return;
- exit(1);
+ if (font) return;
+ exit(1);
}
font = ftmp;
@@ -166,28 +164,25 @@ void RegionClass::set_std_palette(RGBQUAD *pPal)
int i;
for(i=0;i<256;i++)
{
- std_palette[i].rgbRed = pPal[i].rgbRed ;
- std_palette[i].rgbGreen = pPal[i].rgbGreen;
- std_palette[i].rgbBlue = pPal[i].rgbBlue ;
+ std_palette[i].rgbRed = pPal[i].rgbRed ;
+ std_palette[i].rgbGreen = pPal[i].rgbGreen;
+ std_palette[i].rgbBlue = pPal[i].rgbBlue ;
if ( (pPal[i].rgbRed == 0)
&&(pPal[i].rgbGreen == 0)
&&(pPal[i].rgbBlue == 0) )
pix_black = i;
- //白(255, 255, 255)の番号を格納
if ( (pPal[i].rgbRed == 255)
&&(pPal[i].rgbGreen == 255)
&&(pPal[i].rgbBlue == 255) )
pix_white = i;
- //マゼンタ(255, 0, 255)の番号を格納
if ( (pPal[i].rgbRed == 255)
&&(pPal[i].rgbGreen == 0 )
&&(pPal[i].rgbBlue == 255) )
pix_magenta = i;
- //縁の色(1, 1, 1)の番号を格納
if ( (pPal[i].rgbRed == 1)
&&(pPal[i].rgbGreen == 1)
&&(pPal[i].rgbBlue == 1) )
@@ -246,9 +241,9 @@ void RegionClass::init_backbuf(RGBQUAD *pPal, int ncolor)
{
HDC hdc1 = GetDC(0);
HDC hdc2 = GetDC(win->hWnd);
- // alloc a region of the window
+ // alloc a region of the window
backbuf->hDib = CreateDIBSection(hdc1, backbuf->pDib,
- DIB_RGB_COLORS, (VOID **)&(backbuf->pDibBits), NULL, 0);
+ DIB_RGB_COLORS, (VOID **)&(backbuf->pDibBits), NULL, 0);
backbuf->hDC = CreateCompatibleDC(hdc2);
SelectObject(backbuf->hDC, backbuf->hDib);
ReleaseDC(win->hWnd, hdc2);
@@ -256,7 +251,7 @@ void RegionClass::init_backbuf(RGBQUAD *pPal, int ncolor)
}
}
backbuf->pDibZero = (backbuf->pDibBits)
- + (backbuf->Height -1) * backbuf->Width;
+ + (backbuf->Height -1) * backbuf->Width;
}
void RegionClass::resize_backbuf()
@@ -277,14 +272,14 @@ void RegionClass::resize_backbuf()
HDC hdc2 = GetDC(win->hWnd);
// alloc a region of the window
backbuf->hDib = CreateDIBSection(hdc1, backbuf->pDib,
- DIB_RGB_COLORS, (VOID **)&(backbuf->pDibBits), NULL, 0);
+ DIB_RGB_COLORS, (VOID **)&(backbuf->pDibBits), NULL, 0);
backbuf->hDC = CreateCompatibleDC(hdc2);
SelectObject(backbuf->hDC, backbuf->hDib);
ReleaseDC(win->hWnd, hdc2);
ReleaseDC(0, hdc1);
backbuf->pDibZero = (backbuf->pDibBits)
- + (backbuf->Height -1) * backbuf->Width;
+ + (backbuf->Height -1) * backbuf->Width;
for (i = 0; i< mx*dx*my*dy; i++)
*(backbuf->pDibBits + i) = pix_black;
@@ -320,17 +315,16 @@ void TileRegionClass::init_backbuf(RGBQUAD *pPal)
void MapRegionClass::init_backbuf()
{
-//ミニマップ用パレットの作成
BYTE black = 0;
RGBQUAD scol[MAX_MAP_COL];
int i;
for (i=0; i< MAX_MAP_COL;i++)
{
- scol[i].rgbBlue = map_colors[i][2];
- scol[i].rgbGreen = map_colors[i][1];
- scol[i].rgbRed = map_colors[i][0];
- scol[i].rgbReserved = 0;
+ scol[i].rgbBlue = map_colors[i][2];
+ scol[i].rgbGreen = map_colors[i][1];
+ scol[i].rgbRed = map_colors[i][0];
+ scol[i].rgbReserved = 0;
}
// just resize
@@ -341,7 +335,6 @@ void MapRegionClass::init_backbuf()
for (i = 0; i < MAX_MAP_COL; i++)
{
- //黒(0, 0, 0)の番号を格納
if ( (backbuf->pDib->bmiColors[i].rgbRed == 0)
&&(backbuf->pDib->bmiColors[i].rgbGreen == 0)
&&(backbuf->pDib->bmiColors[i].rgbBlue == 0) )
@@ -349,7 +342,7 @@ void MapRegionClass::init_backbuf()
}
for (i = 0; i< mx*dx*my*dy; i++)
- *(backbuf->pDibBits + i) = black; //黒で埋める。
+ *(backbuf->pDibBits + i) = black;
}
// defined to object, not to class
@@ -366,7 +359,7 @@ void TextRegionClass::draw_string(int x, int y, unsigned char *buf,
SetBkColor(hdc, term_pix[col>>4]);
SetTextColor(hdc, term_pix[col&0x0f]);
ExtTextOut(hdc, rc.left, rc.top, ETO_CLIPPED, &rc,
- (char *)buf, len, NULL);
+ (char *)buf, len, NULL);
ReleaseDC(win->hWnd, hdc);
}
@@ -557,9 +550,9 @@ void WinClass::resize()
false, 0);
SetWindowPos(hWnd, 0, ox, oy,
- rc.right - rc.left,
- rc.bottom - rc.top,
- SWP_NOMOVE);
+ rc.right - rc.left,
+ rc.bottom - rc.top,
+ SWP_NOMOVE);
UpdateWindow( hWnd );
}
@@ -594,7 +587,6 @@ void MapRegionClass::draw_data(unsigned char *buf){
if(!flag)return;
LPBYTE ppix ,dpix;
- // 外側、内側の x, y ループでのアドレス増分
int inc_x, inc_y, inc_x0, inc_y0;
int bufx = mx * dx;
int bufy = my * dy;
@@ -619,15 +611,15 @@ void MapRegionClass::draw_data(unsigned char *buf){
inc_y0 = - dx2 * inc_x0 + BUF_IDX(0, 0, 0, 1);
// Draw gauge
- // erase old
+ // erase old
for (j = 0; j < dy*2; j++)
- {
- *(pDibBit0 + BUF_IDX(px, 0, dx/2, j)) = MAP_BLACK;
- }
+ {
+ *(pDibBit0 + BUF_IDX(px, 0, dx/2, j)) = MAP_BLACK;
+ }
for (j = 0; j < dx*2; j++)
- {
- *(pDibBit0 + BUF_IDX(0, py, j, dy/2)) = MAP_BLACK;
- }
+ {
+ *(pDibBit0 + BUF_IDX(0, py, j, dy/2)) = MAP_BLACK;
+ }
dpix = ppix;
for (j = 0; j < my2; j++)
@@ -659,15 +651,15 @@ void MapRegionClass::draw_data(unsigned char *buf){
ppix += inc_y;
}
- // draw gauge
+ // draw gauge
for (j = 0; j < dy*2; j++)
- {
- *(pDibBit0 + BUF_IDX(px, 0, dx/2, j)) = MAP_WHITE;
- }
+ {
+ *(pDibBit0 + BUF_IDX(px, 0, dx/2, j)) = MAP_WHITE;
+ }
for (j = 0; j < dx*2; j++)
- {
- *(pDibBit0 + BUF_IDX(0, py, j, dy/2)) = MAP_WHITE;
- }
+ {
+ *(pDibBit0 + BUF_IDX(0, py, j, dy/2)) = MAP_WHITE;
+ }
redraw();
force_redraw = false;
@@ -715,7 +707,6 @@ void ImgDestroy(img_type img)
{
if (!img) return;
- //if (img->pDibBits) GlobalFree(img->pDibBits);
if (img->pDib) GlobalFree(img->pDib);
if (img->hDC) DeleteDC (img->hDC);
if (img->hDib) DeleteObject(img->hDib);
@@ -763,7 +754,6 @@ img_type ImgLoadFile(const char *name)
return NULL;
}
- //DIB作成
img->hDib = CreateDIBSection(hdc1, img->pDib, DIB_RGB_COLORS,
(VOID **)&(img->pDibBits), NULL,0);
if (img->hDib == NULL)
@@ -774,12 +764,9 @@ img_type ImgLoadFile(const char *name)
}
- //画像のビット列のサイズ
BitsSize = bmHead.bfSize-bmHead.bfOffBits;
- //ビット配列をポイント
SetFilePointer(fh, bmHead.bfOffBits, NULL, FILE_BEGIN);
- //読み込み
if (!ReadFile(fh, img->pDibBits, BitsSize, &dummy, NULL))
{
GlobalFree(img->hDib);
@@ -788,9 +775,8 @@ img_type ImgLoadFile(const char *name)
return NULL;
}
- CloseHandle(fh); //ファイルを閉じる
+ CloseHandle(fh);
- //参照用の構造体に格納
img->Width = img->pDib->bmiHeader.biWidth ;
img->Height = img->pDib->bmiHeader.biHeight;
img->pDibZero = img->pDibBits + (img->Height - 1) * img->Width;
diff --git a/crawl-ref/source/guic.h b/crawl-ref/source/guic.h
index 56a4785f14..bfd43bed51 100644
--- a/crawl-ref/source/guic.h
+++ b/crawl-ref/source/guic.h
@@ -32,13 +32,13 @@ typedef XImage *img_type;
// struct for DIB info
typedef struct dib_pack
{
- LPBITMAPINFO pDib ; //タイルDIBのヘッダ+パレットへのポインタ
- HBITMAP hDib ; //タイルをDIBとして保持
- HDC hDC ; //タイルのデバインコンテキストハンドル
- LPBYTE pDibBits ; //DIBの先頭バイトへのポインタ
- LPBYTE pDibZero ; //DIBの(0,0)点のバイトへのポインタ
- int Width ; //DIBの幅
- int Height ; //DIBの高さ
+ LPBITMAPINFO pDib ;
+ HBITMAP hDib ;
+ HDC hDC ;
+ LPBYTE pDibBits ;
+ LPBYTE pDibZero ;
+ int Width ;
+ int Height ;
} dib_pack;
typedef dib_pack *img_type;
#define ImgWidth(img) (img->Width)
@@ -93,8 +93,6 @@ class WinClass
std::vector<class RegionClass *> regions;
std::vector<int> layers;
- // 同一ウィンドウでダンジョン/インベントリなど同じ場所で
- // 表示を切り替える場合に使用
int active_layer;
// Pointer to the window
@@ -235,37 +233,25 @@ class RegionClass
bool is_active();
void make_active();
- //以下はテキスト/マップ/タイル等の派生クラスで挙動を変える
//Sys indep
- //マウス位置をダンジョン位置に変換、範囲内なら true を返す
// convert mouse point into logical position
virtual bool mouse_pos(int mouse_x, int mouse_y, int *cx, int *cy);
- //矩形領域座標を region 内座標に
virtual bool convert_redraw_rect(int x1, int y1, int x2, int y2,
int *rx1, int *ry1, int *rx2, int *ry2);
- //Sys dep
- // exposure 時などの再描画
virtual void redraw(int x1, int y1, int x2, int y2);
virtual void redraw();
void sys_flush();
- //低レベル描画 カーソル等用
- // TileRegionClass 等では 画面だけでなくバックバッファ内部イメージにも描画
- //長方形を塗りつぶす
virtual void fillrect(int left, int right, int top, int bottom, int color);
- //長方形を描く
virtual void framerect(int left, int right, int top, int bottom, int color);
- // Sys dep
- // 黒で塗る
virtual void clear();
};
-// 派生
class TextRegionClass :public RegionClass
{
public:
@@ -333,9 +319,7 @@ class TileRegionClass :public RegionClass
bool force_redraw;
void DrawPanel(int left, int top, int width, int height);
- //バックバッファで長方形を塗りつぶす
void fillrect(int left, int right, int top, int bottom, int color);
- //バックバッファで長方形を描く
void framerect(int left, int right, int top, int bottom, int color);
bool mouse_pos(int mouse_x, int mouse_y, int *cx, int *cy);
@@ -355,14 +339,11 @@ class TileRegionClass :public RegionClass
#endif
void resize_backbuf();
- // 初期化
TileRegionClass(int mx0, int my0, int dx0, int dy0);
- // 機種依存追加処理
void SysInit(int mx0, int my0, int dx0, int dy0);
void SysDeinit();
- //終了処理
~TileRegionClass();
};
@@ -389,14 +370,11 @@ class MapRegionClass :public RegionClass
void set_col(int col, int x, int y);
int get_col(int x, int y);
- // 初期化
MapRegionClass(int x, int y, int o_x, int o_y, bool iso);
- // 機種依存追加処理
void SysInit(int x, int y, int o_x, int o_y);
void SysDeinit();
- //終了処理
~MapRegionClass();
};
diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc
index ce4a57f984..c2af3ef8c3 100644
--- a/crawl-ref/source/libgui.cc
+++ b/crawl-ref/source/libgui.cc
@@ -205,7 +205,7 @@ static int gmap_ox, gmap_oy;
#define PX_T MAP_YELLOW //trap
#define PX_MS MAP_CYAN //misc
- static const char gmap_col[256] = {
+static const char gmap_col[256] = {
/* 0x00 */ PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, PX_0,
/* 0x08 */ PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, PX_0,
/* 0x10 */ PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, PX_0,
@@ -732,12 +732,12 @@ static void libgui_save_prefs()
for(i=0;i<MAX_PREFS;i++)
{
- struct prefs *p = &pref_data[i];
- int idx = p->dummy_idx;
- if (p->type == 'I')
- dummy_int[pref_mode][idx] = *(int *)p->ptr;
- else if (p->type == 'S')
- strncpy(dummy_str[pref_mode][idx], (char *)p->ptr, MAX_PREF_CHAR);
+ struct prefs *p = &pref_data[i];
+ int idx = p->dummy_idx;
+ if (p->type == 'I')
+ dummy_int[pref_mode][idx] = *(int *)p->ptr;
+ else if (p->type == 'S')
+ strncpy(dummy_str[pref_mode][idx], (char *)p->ptr, MAX_PREF_CHAR);
}
const char *baseTxt = "wininit.txt";
@@ -747,22 +747,22 @@ static void libgui_save_prefs()
if ( (fp = fopen(winTxt, "w")) != NULL )
{
- for (mode = 0; mode < PREF_MODE_NUM; mode++)
- {
- for(i=0;i<MAX_PREFS;i++)
- {
- struct prefs *p = &pref_data[i];
- int idx = p->dummy_idx;
- if (p->type == 'I')
- fprintf(fp, "%s:%s=%d\n", pref_mode_name[mode],
- p->tagname, dummy_int[mode][idx]);
- if (p->type == 'S')
- fprintf(fp, "%s:%s=%s\n", pref_mode_name[mode],
- p->tagname, dummy_str[mode][idx]);
- }
- fprintf(fp, "\n");
- }
- fclose(fp);
+ for (mode = 0; mode < PREF_MODE_NUM; mode++)
+ {
+ for(i=0;i<MAX_PREFS;i++)
+ {
+ struct prefs *p = &pref_data[i];
+ int idx = p->dummy_idx;
+ if (p->type == 'I')
+ fprintf(fp, "%s:%s=%d\n", pref_mode_name[mode],
+ p->tagname, dummy_int[mode][idx]);
+ if (p->type == 'S')
+ fprintf(fp, "%s:%s=%s\n", pref_mode_name[mode],
+ p->tagname, dummy_str[mode][idx]);
+ }
+ fprintf(fp, "\n");
+ }
+ fclose(fp);
}
}
@@ -773,13 +773,13 @@ static void draw_hgauge(int x, int y, int ofs, int region, int len, int col)
textcolor(col);
for (i=0; i < len; i++)
{
- switch((i+ ofs) % 10)
- {
- case 0: cprintf("%c",'+');break;
- case 4: cprintf("%c",'0' + (1+(i+ofs)/10)%10);break;
- case 5: cprintf("%c",'0');break;
- default: cprintf("%c",'-');
- }
+ switch((i+ ofs) % 10)
+ {
+ case 0: cprintf("%c",'+');break;
+ case 4: cprintf("%c",'0' + (1+(i+ofs)/10)%10);break;
+ case 5: cprintf("%c",'0');break;
+ default: cprintf("%c",'-');
+ }
}
}
@@ -790,7 +790,7 @@ static void draw_vgauge(int x, int y, int ofs, int region, int len, int col)
for (i=0; i < len; i++)
{
gotoxy(x, y+i, region);
- cprintf("%02d", ofs+i);
+ cprintf("%02d", ofs+i);
}
}
@@ -811,190 +811,190 @@ void edit_prefs()
while(1)
{
- bool upd_msg = false;
- bool upd_dngn = false;
- bool upd_crt = false;
- bool upd_map = false;
- bool need_resize = false;
- int inc = 0;
+ bool upd_msg = false;
+ bool upd_dngn = false;
+ bool upd_crt = false;
+ bool upd_map = false;
+ bool need_resize = false;
+ int inc = 0;
- if (need_draw_msg)
- {
- textcolor(LIGHTGREY);
+ if (need_draw_msg)
+ {
+ textcolor(LIGHTGREY);
region_msg->clear();
- textcolor(WHITE);
- gotoxy (4, 4, GOTO_MSG);
- cprintf("j, k, up, down : Select pref");
- gotoxy (4, 5, GOTO_MSG);
- cprintf("h, l, left, right : Decrease/Increase");
- gotoxy (4, 6, GOTO_MSG);
- cprintf("H, L : Dec/Inc by 10");
- need_draw_msg = false;
- }
-
- if (need_draw_stat)
- {
+ textcolor(WHITE);
+ gotoxy (4, 4, GOTO_MSG);
+ cprintf("j, k, up, down : Select pref");
+ gotoxy (4, 5, GOTO_MSG);
+ cprintf("h, l, left, right : Decrease/Increase");
+ gotoxy (4, 6, GOTO_MSG);
+ cprintf("H, L : Dec/Inc by 10");
+ need_draw_msg = false;
+ }
+
+ if (need_draw_stat)
+ {
region_stat->clear();
for(i=0; i<MAX_EDIT_PREFS;i++)
{
- struct prefs *p = &pref_data[i];
- gotoxy(2, i+2, GOTO_STAT);
- if (i == cur_pos)
- {
- textcolor(0xf0);
- cprintf(">");
- }
- else
- {
- textcolor(LIGHTGREY);
- cprintf(" ");
- }
- if (pref_data[i].type == 'I')
+ struct prefs *p = &pref_data[i];
+ gotoxy(2, i+2, GOTO_STAT);
+ if (i == cur_pos)
+ {
+ textcolor(0xf0);
+ cprintf(">");
+ }
+ else
+ {
+ textcolor(LIGHTGREY);
+ cprintf(" ");
+ }
+ if (pref_data[i].type == 'I')
cprintf(" %s: %3d ", p->name, *(int *)p->ptr);
- else
+ else
cprintf(" %s: %s", p->name, (char *)p->ptr);
- }
- textcolor(LIGHTGREY);
+ }
+ textcolor(LIGHTGREY);
#ifdef WIN32TILES
- gotoxy(4, MAX_EDIT_PREFS+3, GOTO_STAT);
- cprintf("FONT: %s %d",font_name, font_size);
- if (UseDosChar)
- {
- gotoxy(4, MAX_EDIT_PREFS+4, GOTO_STAT);
- cprintf("DOSFONT: %s %d", dos_font_name, dos_font_size);
- }
+ gotoxy(4, MAX_EDIT_PREFS+3, GOTO_STAT);
+ cprintf("FONT: %s %d",font_name, font_size);
+ if (UseDosChar)
+ {
+ gotoxy(4, MAX_EDIT_PREFS+4, GOTO_STAT);
+ cprintf("DOSFONT: %s %d", dos_font_name, dos_font_size);
+ }
#else
- gotoxy(4, MAX_EDIT_PREFS+3, GOTO_STAT);
- cprintf("FONT: %s",font_name);
+ gotoxy(4, MAX_EDIT_PREFS+3, GOTO_STAT);
+ cprintf("FONT: %s",font_name);
#endif
- int *dat = (int *)pref_data[cur_pos].ptr;
+ int *dat = (int *)pref_data[cur_pos].ptr;
#define WHITEIF(x) (dat == &x)?0xf0:LIGHTGREY
draw_hgauge(3, 1, 3, GOTO_MSG, msg_x-2, WHITEIF(msg_x));
- clear_to_end_of_line();
+ clear_to_end_of_line();
draw_vgauge(1, 1, 1, GOTO_MSG, msg_y, WHITEIF(msg_y));
- need_draw_stat = false;
+ need_draw_stat = false;
}
- int key = getch();
+ int key = getch();
struct prefs *p = &pref_data[cur_pos];
- int *dat = (int *)p->ptr;
-
- if (key == 0x1b || key == '\r') break;
- if (key == 'j' || key == CK_DOWN)
- {
- cur_pos++;
- need_draw_stat = true;
- }
- if (key == 'k' || key == CK_UP)
- {
- cur_pos--;
- need_draw_stat = true;
- }
- if (key == CK_LEFT) key = 'h';
- if (key == CK_RIGHT) key = 'l';
-
- cur_pos = (cur_pos + MAX_EDIT_PREFS) % MAX_EDIT_PREFS;
-
- switch(key)
- {
- case 'l': inc=1; break;
- case 'L': inc=10; break;
- case 'h': inc=-1; break;
- case 'H': inc=-10; break;
- }
-
- int crt_x_old = crt_x;
- int crt_y_old = crt_y;
- int map_px_old = map_px;
- int msg_x_old = msg_x;
- int msg_y_old = msg_y;
- int dngn_x_old = dngn_x;
- int dngn_y_old = dngn_y;
-
- if ( (p->type == 'I') && inc != 0)
- {
- if (dat == &dngn_x || dat == &dngn_y )
- {
- if (inc==1) inc=2;
- if (inc==-1) inc=-2;
- }
- int olddat = *dat;
- (*dat)+= inc;
-
- if (*dat > p->max) *dat = p->max;
- if (*dat < p->min) *dat = p->min;
-
- if (olddat == *dat) continue;
- need_resize = true;
- }// changed
-
- if (need_resize)
- {
- need_draw_stat = need_draw_msg = true;
-
- // crt screen layouts
-
- // resize msg?
- if (msg_x != msg_x_old || msg_y != msg_y_old)
- {
- upd_msg = true;
- region_msg->resize(msg_x, msg_y);
- }
- // resize crt?
- if (crt_x != crt_x_old || crt_y != crt_y_old)
- {
- upd_crt = true;
- region_crt->resize(crt_x, crt_y);
- }
- // resize map?
- if (map_px != map_px_old)
- {
- upd_map = true;
- region_map->resize( 0, 0, map_px, map_px);
- }
-
- // resize dngn tile screen?
- if (dngn_x != dngn_x_old || dngn_y != dngn_y_old)
- {
- clrscr();
- upd_dngn = true;
- tile_dngn_x = dngn_x;
- tile_dngn_y = dngn_y;
- region_tile->resize(dngn_x, dngn_y, 0, 0);
- }
-
- do_layout();
- win_main->resize();
- win_main->clear();
-
- // Now screens are all black
-
- if (upd_map)
- region_map->resize_backbuf();
- if (upd_dngn)
- {
- region_tile -> resize_backbuf();
- force_redraw_tile = true;
- TileResizeScreen(dngn_x, dngn_y);
- }
- if (region_item)
- region_item->resize_backbuf();
- if (region_item2)
- region_item2->resize_backbuf();
- force_redraw_inv = true;
- tile_draw_inv(-1, REGION_INV1);
-
- region_map->force_redraw = true;
- viewwindow(true, true);
- region_tile->redraw();
- region_item->redraw();
- }// need resize
+ int *dat = (int *)p->ptr;
+
+ if (key == 0x1b || key == '\r') break;
+ if (key == 'j' || key == CK_DOWN)
+ {
+ cur_pos++;
+ need_draw_stat = true;
+ }
+ if (key == 'k' || key == CK_UP)
+ {
+ cur_pos--;
+ need_draw_stat = true;
+ }
+ if (key == CK_LEFT) key = 'h';
+ if (key == CK_RIGHT) key = 'l';
+
+ cur_pos = (cur_pos + MAX_EDIT_PREFS) % MAX_EDIT_PREFS;
+
+ switch(key)
+ {
+ case 'l': inc=1; break;
+ case 'L': inc=10; break;
+ case 'h': inc=-1; break;
+ case 'H': inc=-10; break;
+ }
+
+ int crt_x_old = crt_x;
+ int crt_y_old = crt_y;
+ int map_px_old = map_px;
+ int msg_x_old = msg_x;
+ int msg_y_old = msg_y;
+ int dngn_x_old = dngn_x;
+ int dngn_y_old = dngn_y;
+
+ if ( (p->type == 'I') && inc != 0)
+ {
+ if (dat == &dngn_x || dat == &dngn_y )
+ {
+ if (inc==1) inc=2;
+ if (inc==-1) inc=-2;
+ }
+ int olddat = *dat;
+ (*dat)+= inc;
+
+ if (*dat > p->max) *dat = p->max;
+ if (*dat < p->min) *dat = p->min;
+
+ if (olddat == *dat) continue;
+ need_resize = true;
+ }// changed
+
+ if (need_resize)
+ {
+ need_draw_stat = need_draw_msg = true;
+
+ // crt screen layouts
+
+ // resize msg?
+ if (msg_x != msg_x_old || msg_y != msg_y_old)
+ {
+ upd_msg = true;
+ region_msg->resize(msg_x, msg_y);
+ }
+ // resize crt?
+ if (crt_x != crt_x_old || crt_y != crt_y_old)
+ {
+ upd_crt = true;
+ region_crt->resize(crt_x, crt_y);
+ }
+ // resize map?
+ if (map_px != map_px_old)
+ {
+ upd_map = true;
+ region_map->resize( 0, 0, map_px, map_px);
+ }
+
+ // resize dngn tile screen?
+ if (dngn_x != dngn_x_old || dngn_y != dngn_y_old)
+ {
+ clrscr();
+ upd_dngn = true;
+ tile_dngn_x = dngn_x;
+ tile_dngn_y = dngn_y;
+ region_tile->resize(dngn_x, dngn_y, 0, 0);
+ }
+
+ do_layout();
+ win_main->resize();
+ win_main->clear();
+
+ // Now screens are all black
+
+ if (upd_map)
+ region_map->resize_backbuf();
+ if (upd_dngn)
+ {
+ region_tile -> resize_backbuf();
+ force_redraw_tile = true;
+ TileResizeScreen(dngn_x, dngn_y);
+ }
+ if (region_item)
+ region_item->resize_backbuf();
+ if (region_item2)
+ region_item2->resize_backbuf();
+ force_redraw_inv = true;
+ tile_draw_inv(-1, REGION_INV1);
+
+ region_map->force_redraw = true;
+ viewwindow(true, true);
+ region_tile->redraw();
+ region_item->redraw();
+ }// need resize
}//while
clrscr();
redraw_screen();
@@ -1075,7 +1075,7 @@ int convert_cursor_pos(int mx, int my, int *cx, int *cy)
if( (*r)->mouse_pos(mx, my, cx, cy))
{
id = (*r)->id;
- mx0 = (*r)->mx;
+ mx0 = (*r)->mx;
break;
}
}
@@ -1086,7 +1086,7 @@ int convert_cursor_pos(int mx, int my, int *cx, int *cy)
/********************************************/
if(id == REGION_TDNGN)
{
- x--;
+ x--;
if (!in_viewport_bounds(x+1,y+1)) return REGION_NONE;
}
@@ -1098,15 +1098,15 @@ int convert_cursor_pos(int mx, int my, int *cx, int *cy)
if (id == REGION_INV1 || id == REGION_INV2)
{
- x = x + y * mx0;
- y = 0;
+ x = x + y * mx0;
+ y = 0;
}
if (id == REGION_DNGN)
{
// Out of LOS range
if (!in_viewport_bounds(x+1,y+1))
- return REGION_NONE;
+ return REGION_NONE;
}
*cx = x;
@@ -1335,46 +1335,13 @@ static int handle_mouse_motion(int mouse_x, int mouse_y, bool init)
if (mode == REGION_MSG && mouse_mode == MOUSE_MODE_COMMAND)
{
if (oldmode != REGION_MSG)
- update_tip_text("[L-Click] Browse message history");
+ update_tip_text("[L-Click] Browse message history");
oldmode = mode;
oldcx = cx;
oldcy = cy;
return 0;
}
-#if 0
- if (mode == REGION_STAT && mouse_mode == MOUSE_MODE_COMMAND)
- {
- oldcx = cx;
- oldcy = cy;
- oldmode = mode;
-
- int i = 0;
- while( Tips[i].tiptext != NULL)
- {
- if (cx >= Tips[i].sx && cx <= Tips[i].ex &&
- cy >= Tips[i].sy && cy <= Tips[i].ey)
- break;
- i++;
- }
- if (Tips[i].tiptext == NULL) i = -1;
-
- if (i == old_tip_idx) return 0;
-
- if (old_tip_idx != -1)
- hilite_tip_text(old_tip_idx, false);
-
- old_tip_idx = i;
- if (i != -1)
- {
- hilite_tip_text(i, true);
- update_tip_text((char *)Tips[i].tiptext);
- }
- else
- update_tip_text("");
- return 0;
- }
-#endif
return 0;
}
static int handle_mouse_button(int mx, int my, int button,
@@ -1490,30 +1457,6 @@ static int handle_mouse_button(int mx, int my, int button,
return CONTROL('P');
}
-#if 0
- if (mode == REGION_STAT && mouse_mode == MOUSE_MODE_COMMAND)
- {
- int i = 0;
- while( Tips[i].tiptext != NULL)
- {
- if (cx >= Tips[i].sx && cx <= Tips[i].ex &&
- cy >= Tips[i].sy && cy <= Tips[i].ey)
- break;
- i++;
- }
-
- if (Tips[i].tipfilename)
- {
- char fname[256];
- snprintf(fname, 250, "tips_e/%s.txt", Tips[i].tipfilename);
- ViewTextFile(fname);
- redraw_screen();
- return CK_MOUSE_DONE;
- }
- return 0;
- }
-#endif
-
if((mouse_mode==MOUSE_MODE_COMMAND || mouse_mode == MOUSE_MODE_MACRO) &&
(mode == REGION_DNGN || mode == REGION_TDNGN))
{
@@ -1648,31 +1591,31 @@ int getch_ck()
while(1)
{
- k = 0;
- GetNextEvent(&etype, &key, &sh, &ct, &x1, &y1, &x2, &y2);
- switch(etype)
- {
- case EV_BUTTON:
+ k = 0;
+ GetNextEvent(&etype, &key, &sh, &ct, &x1, &y1, &x2, &y2);
+ switch(etype)
+ {
+ case EV_BUTTON:
k = handle_mouse_button(x1, y1, key, sh, ct);
- break;
+ break;
- case EV_MOVE:
+ case EV_MOVE:
k = handle_mouse_motion(x1, y1, false);
- break;
+ break;
- case EV_UNBUTTON:
+ case EV_UNBUTTON:
k = handle_mouse_unbutton(x1, y1, key);
- break;
+ break;
- case EV_KEYIN:
+ case EV_KEYIN:
k = key;
- break;
+ break;
- default:
- break;
- } // switch
+ default:
+ break;
+ } // switch
- if (k != 0) break;
+ if (k != 0) break;
}/*while*/
return k;
@@ -1689,9 +1632,9 @@ int getch()
int keyin = getch_ck();
if (keyin >= CK_UP && keyin <= CK_CTRL_PGDN)
- return ck_tr[ keyin - CK_UP ];
+ return ck_tr[ keyin - CK_UP ];
if (keyin == CK_DELETE)
- return '.';
+ return '.';
return keyin;
}
@@ -1868,17 +1811,17 @@ void get_input_line_gui(char *const buff, int len)
case '\r':
k = strlen(buff);
done = 1;
- lastk = k;
- strncpy(last, buff, k);
+ lastk = k;
+ strncpy(last, buff, k);
break;
- case CK_UP: // history
- if (lastk != 0)
- {
- k = lastk;
- strncpy(buff, last, k);
- }
- break;
+ case CK_UP: // history
+ if (lastk != 0)
+ {
+ k = lastk;
+ strncpy(buff, last, k);
+ }
+ break;
case 0x7F:
case '\010':
@@ -1932,7 +1875,7 @@ void get_input_line_gui(char *const buff, int len)
putch(c);
}
r->addstr((char *)"_ ");
- r->gotoxy(x+k, y);
+ r->gotoxy(x+k, y);
}/* while */
}
@@ -2073,11 +2016,6 @@ void puttext(int sx, int sy, int ex, int ey, unsigned char *buf, bool mono,
{
*c = *ptr;
if (*c==0) *c=32;
-#if 0 //deb
- if (*c==177) *c=2;
- if (*c==176) *c=2;
- if (*c==249) *c=31;
-#endif
ptr++;
if (mono)
diff --git a/crawl-ref/source/rltiles/title.bmp b/crawl-ref/source/rltiles/title.bmp
index 2746a47aa1..84251e3d0c 100644
--- a/crawl-ref/source/rltiles/title.bmp
+++ b/crawl-ref/source/rltiles/title.bmp
Binary files differ
diff --git a/crawl-ref/source/tile2.cc b/crawl-ref/source/tile2.cc
index 844439349a..6908039f4f 100644
--- a/crawl-ref/source/tile2.cc
+++ b/crawl-ref/source/tile2.cc
@@ -2697,17 +2697,20 @@ void TileDrawTitle()
if (!TitleImg)
return;
- // We don't need an entirely separate region for the title, so
- // just resize the tile region to fit the screen temporarily.
- int old_mx = region_tile->mx;
- int old_my = region_tile->my;
- int old_dx = region_tile->dx;
- int old_dy = region_tile->dy;
int winx = win_main->wx;
int winy = win_main->wy;
- region_tile->resize(winx, winy, 1, 1);
- region_tile->resize_backbuf();
- img_type pBuf = region_tile->backbuf;
+
+ TileRegionClass title(winx, winy, 1, 1);
+ title.win = win_main;
+ title.sx = 0;
+ title.sy = 0;
+ title.ex = winx;
+ title.ey = winy;
+ title.wx = winx;
+ title.wy = winy;
+ title.init_backbuf();
+ title.flag = true;
+ img_type pBuf = title.backbuf;
int tx = ImgWidth(TitleImg);
int ty = ImgHeight(TitleImg);
@@ -2735,15 +2738,12 @@ void TileDrawTitle()
}
ImgCopy(TitleImg, 0, 0, tx, ty, pBuf, x, y, 1);
- region_tile->make_active();
- region_tile->redraw();
+ title.make_active();
+ title.redraw();
ImgDestroy(TitleImg);
getch();
clrscr();
-
- region_tile->resize(old_mx, old_my, old_dx, old_dy);
- region_tile->resize_backbuf();
}
static void TilePutch(int c, img_type Dest, int dx, int dy)