• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revision6fb57c9350afc907d593bbe759d7be8cabdc1956 (tree)
Time2002-04-17 21:45:37
Authormogami <mogami@0568...>
Commitermogami

Log Message

いろいろ修正。
- USE_TRANSPARENCY対応。
- タイル高、タイル幅、メニューをちゃんとサポートしていなかったのを修正。
- Bigtileの右半分の再描画ができていなかったのを修正。
- ウィンドウのサイズをマウスで変えたとき変なサイズになってしまうバグ修正。

(MPWのLowWord()が余計なhighbitを持つintを返すというバグだった。)

!!!! To do: 全角ASCIIのモンスターが動いた跡の地形タイルの右半分が再描画されないバグが残っている。

Change Summary

Incremental Difference

--- a/src/main-mac.c
+++ b/src/main-mac.c
@@ -860,16 +860,8 @@ static void term_data_check_size(term_data *td)
860860 /* Allow small windows for the rest */
861861 else
862862 {
863-#ifdef MAC_MPW
864- if ((td->cols < 60) || (td->rows < 18))
865- {
866- td->cols = 60;
867- td->rows = 18;
868- }
869-#else
870863 if (td->cols < 1) td->cols = 1;
871864 if (td->rows < 1) td->rows = 1;
872-#endif
873865 }
874866
875867 /* Minimal tile size */
@@ -921,6 +913,7 @@ static void term_data_check_size(term_data *td)
921913 td->r.bottom = td->r.top + td->size_hgt;
922914
923915 /* Assume no graphics */
916+ td->t->higher_pict = FALSE;
924917 td->t->always_pict = FALSE;
925918
926919 #ifdef ANGBAND_LITE_MAC
@@ -930,9 +923,26 @@ static void term_data_check_size(term_data *td)
930923 #else /* ANGBAND_LITE_MAC */
931924
932925 /* Handle graphics */
933- td->t->higher_pict = TRUE;
926+ if (use_graphics)
927+ {
928+ /* Use higher_pict whenever possible */
929+ if (td->font_mono) td->t->higher_pict = TRUE;
930+
931+ /* Use always_pict only when necessary */
932+ else td->t->always_pict = TRUE;
933+ }
934934
935935 #endif /* ANGBAND_LITE_MAC */
936+
937+ /* Fake mono-space */
938+ if (!td->font_mono ||
939+ (td->font_wid != td->tile_wid) ||
940+ (td->font_hgt != td->tile_hgt))
941+ {
942+ /* Handle fake monospace -- this is SLOW */
943+ if (td->t->higher_pict) td->t->higher_pict = FALSE;
944+ td->t->always_pict = TRUE;
945+ }
936946 }
937947
938948 static OSErr XDDSWUpDateGWorldFromPict( term_data *td );
@@ -990,10 +1000,10 @@ static void term_data_redraw(term_data *td)
9901000 * Constants
9911001 */
9921002
993-static int pictID = 1001; /* 8x8 tiles; 16x16 tiles are 1002 */
1003+static int pictID = 1001; /* 8x8 tiles; 16x16 tiles are 1002 */
9941004
995-static int grafWidth = 8; /* Always equal to grafHeight */
996-static int grafHeight = 8; /* Either 8 or 16 */
1005+static int grafWidth = 8; /* Always equal to grafHeight */
1006+static int grafHeight = 8; /* Either 8 or 16 */
9971007
9981008 static bool arg_newstyle_graphics;
9991009 static bool use_newstyle_graphics;
@@ -1236,21 +1246,23 @@ static OSErr XDDSWUpDateGWorldFromPict( term_data *td )
12361246 //SysBeep(0);
12371247 return;
12381248 }
1239-
1249+
1250+#if 0
12401251 /* Save GWorld */
1241-/* GetGWorld(&saveGWorld, &saveGDevice); */
1252+ GetGWorld(&saveGWorld, &saveGDevice);
12421253
12431254 /* Activate */
1244-/* SetGWorld(td->bufferPort, nil); */
1255+ SetGWorld(td->bufferPort, nil);
12451256
12461257 /* Dump the pict into the GWorld */
1247-/* (void)LockPixels(GetGWorldPixMap(td->bufferPort)); */
1248-/* EraseRect(&td->bufferPort->portRect); */
1258+ (void)LockPixels(GetGWorldPixMap(td->bufferPort));
1259+ EraseRect(&td->bufferPort->portRect);
12491260
1250-/* UnlockPixels(GetGWorldPixMap(td->bufferPort)); */
1261+ UnlockPixels(GetGWorldPixMap(td->bufferPort));
12511262
12521263 /* Restore GWorld */
1253-/* SetGWorld(saveGWorld, saveGDevice); */
1264+ SetGWorld(saveGWorld, saveGDevice);
1265+#endif
12541266
12551267 }
12561268
@@ -1855,7 +1867,12 @@ static errr Term_text_mac(int x, int y, int n, byte a, const char *cp)
18551867 *
18561868 * Erase "n" characters starting at (x,y)
18571869 */
1870+#ifdef USE_TRANSPARENCY
1871+static errr Term_pict_mac(int x, int y, int n, const byte *ap, const char *cp,
1872+ const byte *tap, const char *tcp)
1873+#else
18581874 static errr Term_pict_mac(int x, int y, int n, const byte *ap, const char *cp)
1875+#endif
18591876 {
18601877 int i;
18611878 Rect r2;
@@ -1901,7 +1918,6 @@ static errr Term_pict_mac(int x, int y, int n, const byte *ap, const char *cp)
19011918 {
19021919 /* Destination rectangle */
19031920 r2.left = x * td->tile_wid + td->size_ow1;
1904- r2.right = r2.left + td->tile_wid;
19051921 r2.top = y * td->tile_hgt + td->size_oh1;
19061922 r2.bottom = r2.top + td->tile_hgt;
19071923
@@ -1918,19 +1934,55 @@ static errr Term_pict_mac(int x, int y, int n, const byte *ap, const char *cp)
19181934 byte a = ap[i];
19191935 char c = cp[i];
19201936
1937+ /* Second byte of bigtile */
1938+ if (use_bigtile && a == 255)
1939+ {
1940+ /* Advance */
1941+ r2.left += td->tile_wid;
1942+
1943+ continue;
1944+ }
1945+
1946+ /* Prepare right of rectangle now */
1947+ r2.right = r2.left + td->tile_wid;
1948+
19211949 #ifdef ANGBAND_LITE_MAC
19221950
1923- /* Nothing */
1951+ /* No graphics */
19241952
19251953 #else /* ANGBAND_LITE_MAC */
19261954
19271955 /* Graphics -- if Available and Needed */
1928- if (use_graphics &&
1929- ((byte)a & 0x80) && ((byte)c & 0x80))
1956+ if (use_graphics && ((byte)a & 0x80) && ((byte)c & 0x80))
19301957 {
1958+ BitMapPtr srcBitMap = (BitMapPtr)(frameP->framePix);
1959+ BitMapPtr destBitMap;
1960+
19311961 int col, row;
19321962 Rect r1;
19331963
1964+#ifdef USE_TRANSPARENCY
1965+ Rect terrain_r;
1966+ bool terrain_flag = FALSE;
1967+ byte ta = tap[i];
1968+ char tc = tcp[i];
1969+
1970+ if (a != ta || c != tc)
1971+ {
1972+ /* Row and Col */
1973+ row = ((byte)ta & 0x7F);
1974+ col = ((byte)tc & 0x7F);
1975+
1976+ /* Terrain Source rectangle */
1977+ terrain_r.left = col * grafWidth;
1978+ terrain_r.top = row * grafHeight;
1979+ terrain_r.right = terrain_r.left + grafWidth;
1980+ terrain_r.bottom = terrain_r.top + grafHeight;
1981+
1982+ terrain_flag = TRUE;
1983+ }
1984+#endif
1985+
19341986 /* Row and Col */
19351987 row = ((byte)a & 0x7F);
19361988 col = ((byte)c & 0x7F);
@@ -1946,28 +1998,44 @@ static errr Term_pict_mac(int x, int y, int n, const byte *ap, const char *cp)
19461998 ForeColor(blackColor);
19471999
19482000 /* Draw the picture */
1949- {
1950- BitMapPtr srcBitMap = (BitMapPtr)(frameP->framePix);
1951- BitMapPtr destBitMap;
2001+
2002+ if (use_buffer)
2003+ destBitMap = (BitMapPtr)(td->bufferPix);
2004+ else
2005+ destBitMap = (BitMapPtr)&(td->w->portBits);
19522006
1953- if( use_buffer )
1954- {
1955- destBitMap = (BitMapPtr)(td->bufferPix);
1956- }
1957- else
1958- {
1959- destBitMap = (BitMapPtr)&(td->w->portBits);
1960- }
2007+ if (use_bigtile) r2.right += td->tile_wid;
2008+
2009+#ifdef USE_TRANSPARENCY
2010+ if (terrain_flag)
2011+ {
2012+ /*
2013+ * Source mode const = srcCopy:
2014+ *
2015+ * determine how close the color of the source
2016+ * pixel is to black, and assign this relative
2017+ * amount of foreground color to the
2018+ * destination pixel; determine how close the
2019+ * color of the source pixel is to white, and
2020+ * assign this relative amount of background
2021+ * color to the destination pixel
2022+ */
2023+ CopyBits( srcBitMap, destBitMap, &terrain_r, &r2, srcCopy, NULL );
19612024
1962- /* draw transparent tile */
1963- /* BackColor is ignored and the destination is left untouched */
2025+ /*
2026+ * Draw transparent tile
2027+ * BackColor is ignored and the destination is
2028+ * left untouched
2029+ */
19642030 BackColor(blackColor);
1965-
1966- if (use_bigtile) r2.right += td->tile_wid;
1967-
19682031 CopyBits( srcBitMap, destBitMap, &r1, &r2, transparent, NULL );
1969- if (use_bigtile) r2.right -= td->tile_wid;
19702032 }
2033+ else
2034+#endif /* USE_TRANSPARENCY */
2035+ {
2036+ CopyBits( srcBitMap, destBitMap, &r1, &r2, srcCopy, NULL );
2037+ }
2038+
19712039 /* Restore colors */
19722040 BackColor(blackColor);
19732041 ForeColor(whiteColor);
@@ -1985,51 +2053,46 @@ static errr Term_pict_mac(int x, int y, int n, const byte *ap, const char *cp)
19852053 if (!done)
19862054 {
19872055 int xp, yp;
1988-#ifndef JP
1989- /* Erase */
1990- EraseRect(&r2);
19912056
19922057 /* Set the color */
19932058 term_data_color(td, (a & 0x0F));
1994-
1995- /* Starting pixel */
1996- xp = r2.left + td->tile_o_x;
1997- yp = r2.top + td->tile_o_y;
1998-
1999- /* Move to the correct location */
2000- MoveTo(xp, yp);
2001-
2002- /* Draw the character */
2003- DrawChar(c);
2004-#else
2005- /* Set the color */
2006- term_data_color(td, (a & 0x0F));
20072059
20082060 /* Starting pixel */
20092061 xp = r2.left + td->tile_o_x;
2010- yp = td->tile_o_y;
2062+ yp = r2.top + td->tile_o_y;
20112063
20122064 /* Move to the correct location */
20132065 MoveTo(xp, yp);
20142066
2015- if(iskanji(c)){
2067+#ifdef JP
2068+ if (iskanji(c))
2069+ {
2070+ /* Double width rectangle */
2071+ r2.right += td->tile_wid;
2072+
2073+ /* Erase */
2074+ EraseRect(&r2);
2075+
20162076 /* Draw the character */
20172077 DrawText(cp, i, 2);
20182078
20192079 i++;
20202080
20212081 r2.left += td->tile_wid;
2022- r2.right += td->tile_wid;
2023- } else {
2082+ }
2083+ else
2084+#endif
2085+ {
2086+ /* Erase */
2087+ EraseRect(&r2);
2088+
20242089 /* Draw the character */
20252090 DrawChar(c);
20262091 }
2027-#endif
20282092 }
20292093
20302094 /* Advance */
20312095 r2.left += td->tile_wid;
2032- r2.right += td->tile_wid;
20332096 }
20342097
20352098 if( use_buffer )
@@ -2053,6 +2116,7 @@ static errr Term_pict_mac(int x, int y, int n, const byte *ap, const char *cp)
20532116 destRect.top = y * td->tile_hgt + td->size_oh1;
20542117 destRect.bottom = destRect.top + td->tile_hgt;
20552118
2119+ /* Double width rectangle */
20562120 if (use_bigtile)
20572121 {
20582122 srcRect.right += td->tile_wid * n;
@@ -2068,9 +2132,7 @@ static errr Term_pict_mac(int x, int y, int n, const byte *ap, const char *cp)
20682132 BackColor(whiteColor);
20692133 ForeColor(blackColor);
20702134
2071- //CopyBits( srcBitMap, destBitMap, &srcRect, &destRect, srcCopy, NULL );
2072- CopyBits( (BitMapPtr)(td->bufferPix)
2073- , &(td->w->portBits), &srcRect, &destRect, srcCopy, NULL );
2135+ CopyBits( srcBitMap, destBitMap, &srcRect, &destRect, srcCopy, NULL );
20742136
20752137 /* Restore colors */
20762138 BackColor(blackColor);
@@ -3408,7 +3470,6 @@ static void setup_menus(void)
34083470 if (TRUE)
34093471 {
34103472 EnableItem(m, 7);
3411-/* EnableItem(m, 8); */
34123473 }
34133474
34143475
@@ -3579,9 +3640,6 @@ static void setup_menus(void)
35793640 EnableItem(m, 9);
35803641 CheckItem(m, 9, arg_bigtile);
35813642
3582- /* Item "Hack" */
3583- /* EnableItem(m, 9); */
3584-
35853643
35863644 /* TileWidth menu */
35873645 m = GetMenuHandle(135); //m = GetMHandle(135);
@@ -4472,9 +4530,6 @@ static bool CheckEvents(bool wait)
44724530 /* Hack -- Prepare the menus */
44734531 setup_menus();
44744532
4475- /* Mega-Hack -- allow easy exit if nothing to save */
4476-/* if (!character_generated && (ch=='Q' || ch=='q')) ch = 'e'; */
4477-
44784533 /* Run the Menu-Handler */
44794534 menu(MenuKey(ch));
44804535
@@ -4627,7 +4682,7 @@ static bool CheckEvents(bool wait)
46274682
46284683 case inGrow:
46294684 {
4630- int x, y;
4685+ s16b x, y;
46314686
46324687 term *old = Term;
46334688
@@ -4656,7 +4711,6 @@ static bool CheckEvents(bool wait)
46564711
46574712 /* Apply and Verify */
46584713 term_data_check_size(td);
4659-
46604714 /* Activate */
46614715 Term_activate(td->t);
46624716
@@ -5238,11 +5292,6 @@ BackColor(blackColor);
52385292
52395293 /* Note the "system" */
52405294 ANGBAND_SYS = "mac";
5241-/* #if 0
5242- ANGBAND_GRAF = "new";
5243-#else
5244- ANGBAND_GRAF = "old";
5245-#endif */
52465295
52475296 /* Initialize */
52485297 init_stuff();
Show on old repository browser