Update of /cvsroot/netrek/client/netrekxp/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2053/src
Modified Files:
cowmain.c newwin.c playback.c
Log Message:
Changed it so that if dynamicBitmap is set to off, only the necessary bitmap files will load into memory. This required modifying the load order of the main client function, so that the reset_defaults is called before newwin. Reset_defaults loads the .netrekrc values, which is necessary for reading in what bitmaps the user wants to load. Newwin, among other things, saves the bitmaps into memory. To the best I can tell, changing the order has no unintended side effects.
Index: newwin.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- newwin.c 16 Apr 2006 10:39:38 -0000 1.4
+++ newwin.c 16 Apr 2006 14:18:19 -0000 1.5
@@ -49,18 +49,18 @@
/******************************************************************************/
/*** bitmapExists()
-/*** Called by savebitmaps() to verify bitmap files exist. */
+/*** Called by loadbitmaps() to verify bitmap files exist. */
/******************************************************************************/
int bitmapExists (char * fileName)
{
struct stat buf;
- char * dir;
+ char dir[30];
int i;
sprintf(dir, "bitmaps/shiplib/");
strcat(dir, fileName);
i = stat ( dir, &buf );
-
+
if ( i == 0 )
return 1;
else
@@ -68,6 +68,377 @@
}
/******************************************************************************/
+/*** loadbitmaps(), loadbitmaps1(), loadbitmapsT(), loadbitmapsG(),
+ loadbitmapsM()
+/*** Called by savebitmaps(). */
+/***
+ If any bitmap files in a set are missing, default to the monoscale bitmaps
+ for that set.
+ If the monoscale bitmaps are missing, it's the users fault for deleting his/her
+ bitmap files.
+ This purpose of this code is preventative, as older versions of the client had
+ different bitmap directories names and different bitmap sets. If someone were
+ to use a newer netrek executable without updating the bitmap libraries, this
+ should keep the client working.
+***/
+/******************************************************************************/
+void loadbitmaps()
+{
+ int j,k;
+
+ if (bitmapExists("fedship.bmp")
+ && bitmapExists("indship.bmp")
+ && bitmapExists("kliship.bmp")
+ && bitmapExists("oriship.bmp")
+ && bitmapExists("romship.bmp"))
+ {
+ ship_bitmaps[0] =
+ W_StoreBitmap3 (fed_ship_bmp, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_FED_SHIP, w,
+ LR_DEFAULTCOLOR);
+ ship_bitmaps[1] =
+ W_StoreBitmap3 (ind_ship_bmp, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_IND_SHIP, w,
+ LR_DEFAULTCOLOR);
+ ship_bitmaps[2] =
+ W_StoreBitmap3 (kli_ship_bmp, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_KLI_SHIP, w,
+ LR_DEFAULTCOLOR);
+ ship_bitmaps[3] =
+ W_StoreBitmap3 (ori_ship_bmp, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_ORI_SHIP, w,
+ LR_DEFAULTCOLOR);
+ ship_bitmaps[4] =
+ W_StoreBitmap3 (rom_ship_bmp, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_ROM_SHIP, w,
+ LR_DEFAULTCOLOR);
+ }
+ else /* default to mono */
+ {
+ ship_bitmaps[0] =
+ W_StoreBitmap3 (fed_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_FED_SHIP, w,
+ LR_MONOCHROME);
+ ship_bitmaps[1] =
+ W_StoreBitmap3 (ind_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_IND_SHIP, w,
+ LR_MONOCHROME);
+ ship_bitmaps[2] =
+ W_StoreBitmap3 (kli_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_KLI_SHIP, w,
+ LR_MONOCHROME);
+ ship_bitmaps[3] =
+ W_StoreBitmap3 (ori_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_ORI_SHIP, w,
+ LR_MONOCHROME);
+ ship_bitmaps[4] =
+ W_StoreBitmap3 (rom_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_ROM_SHIP, w,
+ LR_MONOCHROME);
+ }
+
+ for (j = 0; j < NUM_TYPES; j++)
+ {
+ for (k = 0; k < SHIP_VIEWS; k++)
+ {
+ fed_bitmaps[j][k] =
+ W_PointBitmap2 (ship_bitmaps[0], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ ind_bitmaps[j][k] =
+ W_PointBitmap2 (ship_bitmaps[1], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ kli_bitmaps[j][k] =
+ W_PointBitmap2 (ship_bitmaps[2], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ ori_bitmaps[j][k] =
+ W_PointBitmap2 (ship_bitmaps[3], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ rom_bitmaps[j][k] =
+ W_PointBitmap2 (ship_bitmaps[4], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ }
+ }
+}
+
+void loadbitmaps1()
+{
+ int j,k;
+
+ if (bitmapExists("fedship1.bmp")
+ && bitmapExists("indship1.bmp")
+ && bitmapExists("kliship1.bmp")
+ && bitmapExists("oriship1.bmp")
+ && bitmapExists("romship1.bmp"))
+ {
+ ship_bitmaps1[0] =
+ W_StoreBitmap3 (fed_ship_bmp_1, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_FED_SHIP, w,
+ LR_DEFAULTCOLOR);
+ ship_bitmaps1[1] =
+ W_StoreBitmap3 (ind_ship_bmp_1, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_IND_SHIP, w,
+ LR_DEFAULTCOLOR);
+ ship_bitmaps1[2] =
+ W_StoreBitmap3 (kli_ship_bmp_1, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_KLI_SHIP, w,
+ LR_DEFAULTCOLOR);
+ ship_bitmaps1[3] =
+ W_StoreBitmap3 (ori_ship_bmp_1, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_ORI_SHIP, w,
+ LR_DEFAULTCOLOR);
+ ship_bitmaps1[4] =
+ W_StoreBitmap3 (rom_ship_bmp_1, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_ROM_SHIP, w,
+ LR_DEFAULTCOLOR);
+ }
+ else /* default to mono */
+ {
+ ship_bitmaps1[0] =
+ W_StoreBitmap3 (fed_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_FED_SHIP, w,
+ LR_MONOCHROME);
+ ship_bitmaps1[1] =
+ W_StoreBitmap3 (ind_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_IND_SHIP, w,
+ LR_MONOCHROME);
+ ship_bitmaps1[2] =
+ W_StoreBitmap3 (kli_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_KLI_SHIP, w,
+ LR_MONOCHROME);
+ ship_bitmaps1[3] =
+ W_StoreBitmap3 (ori_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_ORI_SHIP, w,
+ LR_MONOCHROME);
+ ship_bitmaps1[4] =
+ W_StoreBitmap3 (rom_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_ROM_SHIP, w,
+ LR_MONOCHROME);
+ }
+ for (j = 0; j < NUM_TYPES; j++)
+ {
+ for (k = 0; k < SHIP_VIEWS; k++)
+ {
+ fed_bitmaps1[j][k] =
+ W_PointBitmap2 (ship_bitmaps1[0], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ ind_bitmaps1[j][k] =
+ W_PointBitmap2 (ship_bitmaps1[1], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ kli_bitmaps1[j][k] =
+ W_PointBitmap2 (ship_bitmaps1[2], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ ori_bitmaps1[j][k] =
+ W_PointBitmap2 (ship_bitmaps1[3], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ rom_bitmaps1[j][k] =
+ W_PointBitmap2 (ship_bitmaps1[4], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ }
+ }
+}
+
+void loadbitmapsT()
+{
+ int j,k;
+
+ if (bitmapExists("fedshipT.bmp")
+ && bitmapExists("indshipT.bmp")
+ && bitmapExists("klishipT.bmp")
+ && bitmapExists("orishipT.bmp")
+ && bitmapExists("romshipT.bmp"))
+ {
+ ship_bitmapsT[0] =
+ W_StoreBitmap3 (fed_ship_bmp_T, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_FED_SHIP, w,
+ LR_DEFAULTCOLOR);
+ ship_bitmapsT[1] =
+ W_StoreBitmap3 (ind_ship_bmp_T, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_IND_SHIP, w,
+ LR_DEFAULTCOLOR);
+ ship_bitmapsT[2] =
+ W_StoreBitmap3 (kli_ship_bmp_T, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_KLI_SHIP, w,
+ LR_DEFAULTCOLOR);
+ ship_bitmapsT[3] =
+ W_StoreBitmap3 (ori_ship_bmp_T, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_ORI_SHIP, w,
+ LR_DEFAULTCOLOR);
+ ship_bitmapsT[4] =
+ W_StoreBitmap3 (rom_ship_bmp_T, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_ROM_SHIP, w,
+ LR_DEFAULTCOLOR);
+ }
+ else /* default to mono */
+ {
+ ship_bitmapsT[0] =
+ W_StoreBitmap3 (fed_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_FED_SHIP, w,
+ LR_MONOCHROME);
+ ship_bitmapsT[1] =
+ W_StoreBitmap3 (ind_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_IND_SHIP, w,
+ LR_MONOCHROME);
+ ship_bitmapsT[2] =
+ W_StoreBitmap3 (kli_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_KLI_SHIP, w,
+ LR_MONOCHROME);
+ ship_bitmapsT[3] =
+ W_StoreBitmap3 (ori_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_ORI_SHIP, w,
+ LR_MONOCHROME);
+ ship_bitmapsT[4] =
+ W_StoreBitmap3 (rom_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_ROM_SHIP, w,
+ LR_MONOCHROME);
+ }
+ for (j = 0; j < NUM_TYPES; j++)
+ {
+ for (k = 0; k < SHIP_VIEWS; k++)
+ {
+ fed_bitmapsT[j][k] =
+ W_PointBitmap2 (ship_bitmapsT[0], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ ind_bitmapsT[j][k] =
+ W_PointBitmap2 (ship_bitmapsT[1], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ kli_bitmapsT[j][k] =
+ W_PointBitmap2 (ship_bitmapsT[2], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ ori_bitmapsT[j][k] =
+ W_PointBitmap2 (ship_bitmapsT[3], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ rom_bitmapsT[j][k] =
+ W_PointBitmap2 (ship_bitmapsT[4], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ }
+ }
+}
+
+void loadbitmapsG()
+{
+ int j,k;
+
+ if (bitmapExists("fedshipG.bmp")
+ && bitmapExists("indshipG.bmp")
+ && bitmapExists("klishipG.bmp")
+ && bitmapExists("orishipG.bmp")
+ && bitmapExists("romshipG.bmp"))
+ {
+ ship_bitmapsG[0] =
+ W_StoreBitmap3 (fed_ship_bmp_G, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_FED_SHIP, w,
+ LR_DEFAULTCOLOR);
+ ship_bitmapsG[1] =
+ W_StoreBitmap3 (ind_ship_bmp_G, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_IND_SHIP, w,
+ LR_DEFAULTCOLOR);
+ ship_bitmapsG[2] =
+ W_StoreBitmap3 (kli_ship_bmp_G, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_KLI_SHIP, w,
+ LR_DEFAULTCOLOR);
+ ship_bitmapsG[3] =
+ W_StoreBitmap3 (ori_ship_bmp_G, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_ORI_SHIP, w,
+ LR_DEFAULTCOLOR);
+ ship_bitmapsG[4] =
+ W_StoreBitmap3 (rom_ship_bmp_G, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_ROM_SHIP, w,
+ LR_DEFAULTCOLOR);
+ }
+ else /* default to mono */
+ {
+ ship_bitmapsG[0] =
+ W_StoreBitmap3 (fed_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_FED_SHIP, w,
+ LR_MONOCHROME);
+ ship_bitmapsG[1] =
+ W_StoreBitmap3 (ind_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_IND_SHIP, w,
+ LR_MONOCHROME);
+ ship_bitmapsG[2] =
+ W_StoreBitmap3 (kli_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_KLI_SHIP, w,
+ LR_MONOCHROME);
+ ship_bitmapsG[3] =
+ W_StoreBitmap3 (ori_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_ORI_SHIP, w,
+ LR_MONOCHROME);
+ ship_bitmapsG[4] =
+ W_StoreBitmap3 (rom_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_ROM_SHIP, w,
+ LR_MONOCHROME);
+ }
+ for (j = 0; j < NUM_TYPES; j++)
+ {
+ for (k = 0; k < SHIP_VIEWS; k++)
+ {
+ fed_bitmapsG[j][k] =
+ W_PointBitmap2 (ship_bitmapsG[0], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ ind_bitmapsG[j][k] =
+ W_PointBitmap2 (ship_bitmapsG[1], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ kli_bitmapsG[j][k] =
+ W_PointBitmap2 (ship_bitmapsG[2], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ ori_bitmapsG[j][k] =
+ W_PointBitmap2 (ship_bitmapsG[3], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ rom_bitmapsG[j][k] =
+ W_PointBitmap2 (ship_bitmapsG[4], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ }
+ }
+}
+
+void loadbitmapsM()
+{
+ int j,k;
+
+ ship_bitmapsM[0] =
+ W_StoreBitmap3 (fed_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_FED_SHIP, w,
+ LR_MONOCHROME);
+ ship_bitmapsM[1] =
+ W_StoreBitmap3 (ind_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_IND_SHIP, w,
+ LR_MONOCHROME);
+ ship_bitmapsM[2] =
+ W_StoreBitmap3 (kli_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_KLI_SHIP, w,
+ LR_MONOCHROME);
+ ship_bitmapsM[3] =
+ W_StoreBitmap3 (ori_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_ORI_SHIP, w,
+ LR_MONOCHROME);
+ ship_bitmapsM[4] =
+ W_StoreBitmap3 (rom_ship_bmp_M, BMP_SHIP_WIDTH * 8,
+ BMP_SHIP_HEIGHT * 32, BMP_ROM_SHIP, w,
+ LR_MONOCHROME);
+
+ for (j = 0; j < NUM_TYPES; j++)
+ {
+ for (k = 0; k < SHIP_VIEWS; k++)
+ {
+ fed_bitmapsM[j][k] =
+ W_PointBitmap2 (ship_bitmapsM[0], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ ind_bitmapsM[j][k] =
+ W_PointBitmap2 (ship_bitmapsM[1], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ kli_bitmapsM[j][k] =
+ W_PointBitmap2 (ship_bitmapsM[2], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ ori_bitmapsM[j][k] =
+ W_PointBitmap2 (ship_bitmapsM[3], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ rom_bitmapsM[j][k] =
+ W_PointBitmap2 (ship_bitmapsM[4], j, k, BMP_SHIP_WIDTH,
+ BMP_SHIP_HEIGHT);
+ }
+ }
+}
+/******************************************************************************/
/*** handleMessageWindowKeyDown()
/******************************************************************************/
static void
@@ -367,328 +738,34 @@
MPlanlib = "bitmaps/planlibm/mplan.bmp";
break;
}
-
-/*
- Load all the bitmaps in, so the user can toggle between any type if
- dynamicBitmaps is set.
- If any bitmap files in a set are missing, default to the monoscale bitmaps
- for that set.
- If the monoscale bitmaps are missing, it's the users fault for deleting his/her
- bitmap files.
- This purpose of this code is preventative, as older versions of the client had
- different bitmap directories names and different bitmap sets. If someone were
- to use a newer netrek executable without updating the bitmap libraries, this
- should keep the client working.
-*/
-
- if (bitmapExists("fedship.bmp")
- && bitmapExists("indship.bmp")
- && bitmapExists("kliship.bmp")
- && bitmapExists("oriship.bmp")
- && bitmapExists("romship.bmp"))
- {
- ship_bitmaps[0] =
- W_StoreBitmap3 (fed_ship_bmp, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_FED_SHIP, w,
- LR_DEFAULTCOLOR);
- ship_bitmaps[1] =
- W_StoreBitmap3 (ind_ship_bmp, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_IND_SHIP, w,
- LR_DEFAULTCOLOR);
- ship_bitmaps[2] =
- W_StoreBitmap3 (kli_ship_bmp, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_KLI_SHIP, w,
- LR_DEFAULTCOLOR);
- ship_bitmaps[3] =
- W_StoreBitmap3 (ori_ship_bmp, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_ORI_SHIP, w,
- LR_DEFAULTCOLOR);
- ship_bitmaps[4] =
- W_StoreBitmap3 (rom_ship_bmp, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_ROM_SHIP, w,
- LR_DEFAULTCOLOR);
- }
- else /* default to mono */
- {
- ship_bitmaps[0] =
- W_StoreBitmap3 (fed_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_FED_SHIP, w,
- LR_MONOCHROME);
- ship_bitmaps[1] =
- W_StoreBitmap3 (ind_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_IND_SHIP, w,
- LR_MONOCHROME);
- ship_bitmaps[2] =
- W_StoreBitmap3 (kli_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_KLI_SHIP, w,
- LR_MONOCHROME);
- ship_bitmaps[3] =
- W_StoreBitmap3 (ori_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_ORI_SHIP, w,
- LR_MONOCHROME);
- ship_bitmaps[4] =
- W_StoreBitmap3 (rom_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_ROM_SHIP, w,
- LR_MONOCHROME);
- }
-
- if (bitmapExists("fedship1.bmp")
- && bitmapExists("indship1.bmp")
- && bitmapExists("kliship1.bmp")
- && bitmapExists("oriship1.bmp")
- && bitmapExists("romship1.bmp"))
- {
- ship_bitmaps1[0] =
- W_StoreBitmap3 (fed_ship_bmp_1, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_FED_SHIP, w,
- LR_DEFAULTCOLOR);
- ship_bitmaps1[1] =
- W_StoreBitmap3 (ind_ship_bmp_1, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_IND_SHIP, w,
- LR_DEFAULTCOLOR);
- ship_bitmaps1[2] =
- W_StoreBitmap3 (kli_ship_bmp_1, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_KLI_SHIP, w,
- LR_DEFAULTCOLOR);
- ship_bitmaps1[3] =
- W_StoreBitmap3 (ori_ship_bmp_1, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_ORI_SHIP, w,
- LR_DEFAULTCOLOR);
- ship_bitmaps1[4] =
- W_StoreBitmap3 (rom_ship_bmp_1, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_ROM_SHIP, w,
- LR_DEFAULTCOLOR);
- }
- else /* default to mono */
- {
- ship_bitmaps1[0] =
- W_StoreBitmap3 (fed_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_FED_SHIP, w,
- LR_MONOCHROME);
- ship_bitmaps1[1] =
- W_StoreBitmap3 (ind_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_IND_SHIP, w,
- LR_MONOCHROME);
- ship_bitmaps1[2] =
- W_StoreBitmap3 (kli_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_KLI_SHIP, w,
- LR_MONOCHROME);
- ship_bitmaps1[3] =
- W_StoreBitmap3 (ori_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_ORI_SHIP, w,
- LR_MONOCHROME);
- ship_bitmaps1[4] =
- W_StoreBitmap3 (rom_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_ROM_SHIP, w,
- LR_MONOCHROME);
- }
- if (bitmapExists("fedshipT.bmp")
- && bitmapExists("indshipT.bmp")
- && bitmapExists("klishipT.bmp")
- && bitmapExists("orishipT.bmp")
- && bitmapExists("romshipT.bmp"))
- {
- ship_bitmapsT[0] =
- W_StoreBitmap3 (fed_ship_bmp_T, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_FED_SHIP, w,
- LR_DEFAULTCOLOR);
- ship_bitmapsT[1] =
- W_StoreBitmap3 (ind_ship_bmp_T, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_IND_SHIP, w,
- LR_DEFAULTCOLOR);
- ship_bitmapsT[2] =
- W_StoreBitmap3 (kli_ship_bmp_T, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_KLI_SHIP, w,
- LR_DEFAULTCOLOR);
- ship_bitmapsT[3] =
- W_StoreBitmap3 (ori_ship_bmp_T, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_ORI_SHIP, w,
- LR_DEFAULTCOLOR);
- ship_bitmapsT[4] =
- W_StoreBitmap3 (rom_ship_bmp_T, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_ROM_SHIP, w,
- LR_DEFAULTCOLOR);
- }
- else /* default to mono */
- {
- ship_bitmapsT[0] =
- W_StoreBitmap3 (fed_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_FED_SHIP, w,
- LR_MONOCHROME);
- ship_bitmapsT[1] =
- W_StoreBitmap3 (ind_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_IND_SHIP, w,
- LR_MONOCHROME);
- ship_bitmapsT[2] =
- W_StoreBitmap3 (kli_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_KLI_SHIP, w,
- LR_MONOCHROME);
- ship_bitmapsT[3] =
- W_StoreBitmap3 (ori_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_ORI_SHIP, w,
- LR_MONOCHROME);
- ship_bitmapsT[4] =
- W_StoreBitmap3 (rom_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_ROM_SHIP, w,
- LR_MONOCHROME);
- }
-
- if (bitmapExists("fedshipG.bmp")
- && bitmapExists("indshipG.bmp")
- && bitmapExists("klishipG.bmp")
- && bitmapExists("orishipG.bmp")
- && bitmapExists("romshipG.bmp"))
- {
- ship_bitmapsG[0] =
- W_StoreBitmap3 (fed_ship_bmp_G, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_FED_SHIP, w,
- LR_DEFAULTCOLOR);
- ship_bitmapsG[1] =
- W_StoreBitmap3 (ind_ship_bmp_G, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_IND_SHIP, w,
- LR_DEFAULTCOLOR);
- ship_bitmapsG[2] =
- W_StoreBitmap3 (kli_ship_bmp_G, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_KLI_SHIP, w,
- LR_DEFAULTCOLOR);
- ship_bitmapsG[3] =
- W_StoreBitmap3 (ori_ship_bmp_G, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_ORI_SHIP, w,
- LR_DEFAULTCOLOR);
- ship_bitmapsG[4] =
- W_StoreBitmap3 (rom_ship_bmp_G, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_ROM_SHIP, w,
- LR_DEFAULTCOLOR);
- }
- else /* default to mono */
+ if (!dynamicBitmaps) /* Only load needed bitmaps */
{
- ship_bitmapsG[0] =
- W_StoreBitmap3 (fed_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_FED_SHIP, w,
- LR_MONOCHROME);
- ship_bitmapsG[1] =
- W_StoreBitmap3 (ind_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_IND_SHIP, w,
- LR_MONOCHROME);
- ship_bitmapsG[2] =
- W_StoreBitmap3 (kli_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_KLI_SHIP, w,
- LR_MONOCHROME);
- ship_bitmapsG[3] =
- W_StoreBitmap3 (ori_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_ORI_SHIP, w,
- LR_MONOCHROME);
- ship_bitmapsG[4] =
- W_StoreBitmap3 (rom_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_ROM_SHIP, w,
- LR_MONOCHROME);
+ switch (colorClient)
+ {
+ case 1: /* New color bitmaps */
+ loadbitmaps1();
+ break;
+ case 2: /* Old color bitmaps + greyscale for player's ship */
+ loadbitmaps();
+ loadbitmapsG();
+ break;
+ case 3: /* Shaded color bitmaps + greyscale for player's ship */
+ loadbitmapsT();
+ loadbitmapsG();
+ break;
+ default: /* mono */
+ loadbitmapsM();
+ break;
+ }
}
-
- ship_bitmapsM[0] =
- W_StoreBitmap3 (fed_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_FED_SHIP, w,
- LR_MONOCHROME);
- ship_bitmapsM[1] =
- W_StoreBitmap3 (ind_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_IND_SHIP, w,
- LR_MONOCHROME);
- ship_bitmapsM[2] =
- W_StoreBitmap3 (kli_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_KLI_SHIP, w,
- LR_MONOCHROME);
- ship_bitmapsM[3] =
- W_StoreBitmap3 (ori_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_ORI_SHIP, w,
- LR_MONOCHROME);
- ship_bitmapsM[4] =
- W_StoreBitmap3 (rom_ship_bmp_M, BMP_SHIP_WIDTH * 8,
- BMP_SHIP_HEIGHT * 32, BMP_ROM_SHIP, w,
- LR_MONOCHROME);
-
- for (j = 0; j < NUM_TYPES; j++)
+ else /* Load all bitmaps */
{
- for (k = 0; k < SHIP_VIEWS; k++)
- {
- fed_bitmapsT[j][k] =
- W_PointBitmap2 (ship_bitmapsT[0], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- fed_bitmapsM[j][k] =
- W_PointBitmap2 (ship_bitmapsM[0], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- fed_bitmapsG[j][k] =
- W_PointBitmap2 (ship_bitmapsG[0], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- fed_bitmaps1[j][k] =
- W_PointBitmap2 (ship_bitmaps1[0], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- fed_bitmaps[j][k] =
- W_PointBitmap2 (ship_bitmaps[0], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- ind_bitmapsT[j][k] =
- W_PointBitmap2 (ship_bitmapsT[1], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- ind_bitmapsM[j][k] =
- W_PointBitmap2 (ship_bitmapsM[1], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- ind_bitmapsG[j][k] =
- W_PointBitmap2 (ship_bitmapsG[1], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- ind_bitmaps1[j][k] =
- W_PointBitmap2 (ship_bitmaps1[1], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- ind_bitmaps[j][k] =
- W_PointBitmap2 (ship_bitmaps[1], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- ind_bitmapsT[j][k] =
- W_PointBitmap2 (ship_bitmapsT[1], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- kli_bitmapsT[j][k] =
- W_PointBitmap2 (ship_bitmapsT[2], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- kli_bitmapsM[j][k] =
- W_PointBitmap2 (ship_bitmapsM[2], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- kli_bitmapsG[j][k] =
- W_PointBitmap2 (ship_bitmapsG[2], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- kli_bitmaps1[j][k] =
- W_PointBitmap2 (ship_bitmaps1[2], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- kli_bitmaps[j][k] =
- W_PointBitmap2 (ship_bitmaps[2], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- ori_bitmapsT[j][k] =
- W_PointBitmap2 (ship_bitmapsT[3], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- ori_bitmapsM[j][k] =
- W_PointBitmap2 (ship_bitmapsM[3], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- ori_bitmapsG[j][k] =
- W_PointBitmap2 (ship_bitmapsG[3], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- ori_bitmaps1[j][k] =
- W_PointBitmap2 (ship_bitmaps1[3], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- ori_bitmaps[j][k] =
- W_PointBitmap2 (ship_bitmaps[3], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- rom_bitmapsT[j][k] =
- W_PointBitmap2 (ship_bitmapsT[4], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- rom_bitmapsM[j][k] =
- W_PointBitmap2 (ship_bitmapsM[4], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- rom_bitmapsG[j][k] =
- W_PointBitmap2 (ship_bitmapsG[4], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- rom_bitmaps1[j][k] =
- W_PointBitmap2 (ship_bitmaps1[4], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- rom_bitmaps[j][k] =
- W_PointBitmap2 (ship_bitmaps[4], j, k, BMP_SHIP_WIDTH,
- BMP_SHIP_HEIGHT);
- }
+ loadbitmaps();
+ loadbitmaps1();
+ loadbitmapsG();
+ loadbitmapsT();
+ loadbitmapsM();
}
/* Experimental weapons */
Index: cowmain.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/cowmain.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cowmain.c 16 Apr 2006 10:39:38 -0000 1.4
+++ cowmain.c 16 Apr 2006 14:18:19 -0000 1.5
@@ -754,6 +754,8 @@
if ((stringDefault ("indshipMbmpfile")) != NULL)
ind_ship_bmp_M = stringDefault ("indshipMbmpfile");
+
+ resetdefaults ();
newwin (display_host, name);
#ifdef META
@@ -775,8 +777,6 @@
/* Set observer flag as soon as we know port number */
setObserverMode (xtrekPort);
- resetdefaults ();
-
/* open memory...? */
openmem ();
Index: playback.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/playback.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- playback.c 16 Apr 2006 10:39:38 -0000 1.4
+++ playback.c 16 Apr 2006 14:18:19 -0000 1.5
@@ -175,9 +175,8 @@
if ((stringDefault ("indshipMbmpfile")) != NULL)
ind_ship_bmp_M = stringDefault ("indshipMbmpfile");
- newwin (display_host, name);
-
resetdefaults ();
+ newwin (display_host, name);
/* open memory...? */
openmem ();