Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs16:/tmp/cvs-serv31445/src Modified Files: beeplite.c data.c death.c defaults.c feature.c findslot.c getship.c inform.c input.c local.c map.c mswindow.c newwin.c planetlist.c playerlist.c socket.c Log Message: A bunch of paradise additions, mostly separated by #ifdef's but a few things impact outside that condition, which are listed below. 1) Added paradise ships (CL, CV, FL, JS, PT, UT, WB) bitmap set and bitmaps for stars (local and map). 2) New function W_WriteRectangle, only used in paradise gridbox drawing, but it's available for general use. 3) Removed unused PLCLEAR flag. It overlapped with a paradise flag, and it wasn't used at all with current code so I just removed it. 4) Moved the redrawall = 0 from near top of main map function to bottom. I don't see any harm in doing this, and it was necessary to get a paradise draw function to work. 5) The BIGBITMAP_WIDTH size was changed from 240x240 to 500x500 to accomodate MOTD pics from paradise servers. Again I don't see any harm in increasing size. And this wasn't even used with bitmap storage, the StoreBitmap() function had been completely phased out. Along the way of adding in paradise functionality, numerous problems with defines have come up, ie MAXSECTOR, GWIDTH, ship array, and most seriously, overlapping packet types. There are also very serious problems with overlapping p_flag and p_status values, namely observers overlap with warp states and tournament queue status. Some p_whydead messages also overlap. Also paradise servers send phaser damage caps differently. Things that could use work are the motd paging system (gutted it for sake of simplicity), planet window (paradise has 2 planet windows, also sorting doesn't work), a bunch of gridline/zoom options should be made into netrekrc options. The galactic zoom doesn't work. Ships disappear while warping (due to the aforementioned problem with PFOBSERV overlap with PFWARP). Most of the paradise packet types, including special weapons and game parameters, are still not handled. Gwidth is not malleable based on paradise vs bronco server. No color ship bitmaps were added. No special items other than stars were added. No new weapon types like fighters were added. A bunch of keys like afterburners and engage warp don't exist. Info windows and rank windows not working right with paradise. Index: getship.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/getship.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- getship.c 15 Jun 2006 05:09:04 -0000 1.4 +++ getship.c 17 May 2007 08:49:48 -0000 1.5 @@ -145,6 +145,128 @@ shipvals[CRUISER].s_type = CRUISER; /* cruiser: */ shipvals[CRUISER].s_phaserfuse = 10; /* cruiser: */ shipvals[CRUISER].s_repair = 110; /* cruiser: */ + +#ifdef PARADISE + shipvals[JUMPSHIP].s_phaserdamage = 25; + shipvals[JUMPSHIP].s_torpspeed = 18; + shipvals[JUMPSHIP].s_maxspeed = 20; + shipvals[JUMPSHIP].s_maxfuel = 50000; + shipvals[JUMPSHIP].s_maxarmies = 0; + shipvals[JUMPSHIP].s_maxshield = 5; + shipvals[JUMPSHIP].s_maxdamage = 60; + shipvals[JUMPSHIP].s_maxwpntemp = 1300; + shipvals[JUMPSHIP].s_maxegntemp = 5000; + shipvals[JUMPSHIP].s_type = JUMPSHIP; + shipvals[JUMPSHIP].s_width = 20; + shipvals[JUMPSHIP].s_height = 20; + shipvals[JUMPSHIP].s_phaserfuse = 4; + shipvals[JUMPSHIP].s_repair = 200; + + shipvals[FLAGSHIP].s_phaserdamage = 102; + shipvals[FLAGSHIP].s_torpspeed = 12; + shipvals[FLAGSHIP].s_maxspeed = 9; + shipvals[FLAGSHIP].s_maxfuel = 12500; + shipvals[FLAGSHIP].s_maxarmies = 6; + shipvals[FLAGSHIP].s_maxshield = 115; + shipvals[FLAGSHIP].s_maxdamage = 115; + shipvals[FLAGSHIP].s_maxwpntemp = 1000; + shipvals[FLAGSHIP].s_maxegntemp = 1500; + shipvals[FLAGSHIP].s_type = FLAGSHIP; + shipvals[FLAGSHIP].s_width = 20; + shipvals[FLAGSHIP].s_height = 20; + shipvals[FLAGSHIP].s_phaserfuse = 10; + shipvals[FLAGSHIP].s_repair = 118; + + shipvals[WARBASE].s_phaserdamage = 125; + shipvals[WARBASE].s_torpspeed = 15; + shipvals[WARBASE].s_maxspeed = 3; + shipvals[WARBASE].s_maxfuel = 50000; + shipvals[WARBASE].s_maxarmies = 0; + shipvals[WARBASE].s_maxshield = 250; + shipvals[WARBASE].s_maxdamage = 500; + shipvals[WARBASE].s_maxwpntemp = 1500; + shipvals[WARBASE].s_maxegntemp = 1000; + shipvals[WARBASE].s_type = WARBASE; + shipvals[WARBASE].s_width = 20; + shipvals[WARBASE].s_height = 20; + shipvals[WARBASE].s_phaserfuse = 5; + shipvals[WARBASE].s_repair = 170; + + shipvals[LIGHTCRUISER].s_phaserdamage = 90; + shipvals[LIGHTCRUISER].s_torpspeed = 13; + shipvals[LIGHTCRUISER].s_maxspeed = 10; + shipvals[LIGHTCRUISER].s_maxfuel = 8500; + shipvals[LIGHTCRUISER].s_maxarmies = 3; + shipvals[LIGHTCRUISER].s_maxshield = 95; + shipvals[LIGHTCRUISER].s_maxdamage = 90; + shipvals[LIGHTCRUISER].s_maxwpntemp = 1000; + shipvals[LIGHTCRUISER].s_maxegntemp = 1500; + shipvals[LIGHTCRUISER].s_type = LIGHTCRUISER; + shipvals[LIGHTCRUISER].s_width = 20; + shipvals[LIGHTCRUISER].s_height = 20; + shipvals[LIGHTCRUISER].s_phaserfuse = 10; + shipvals[LIGHTCRUISER].s_repair = 80; + + shipvals[CARRIER].s_phaserdamage = 95; + shipvals[CARRIER].s_torpspeed = 13; + shipvals[CARRIER].s_maxspeed = 9; + shipvals[CARRIER].s_maxfuel = 15000; + shipvals[CARRIER].s_maxarmies = 3; + shipvals[CARRIER].s_maxshield = 120; + shipvals[CARRIER].s_maxdamage = 150; + shipvals[CARRIER].s_maxwpntemp = 1000; + shipvals[CARRIER].s_maxegntemp = 1500; + shipvals[CARRIER].s_type = CARRIER; + shipvals[CARRIER].s_width = 20; + shipvals[CARRIER].s_height = 20; + shipvals[CARRIER].s_phaserfuse = 6; + shipvals[CARRIER].s_repair = 105; + + shipvals[UTILITY].s_phaserdamage = 80; + shipvals[UTILITY].s_torpspeed = 15; + shipvals[UTILITY].s_maxspeed = 7; + shipvals[UTILITY].s_maxfuel = 16000; + shipvals[UTILITY].s_maxarmies = 12; + shipvals[UTILITY].s_maxshield = 120; + shipvals[UTILITY].s_maxdamage = 220; + shipvals[UTILITY].s_maxwpntemp = 1000; + shipvals[UTILITY].s_maxegntemp = 1800; + shipvals[UTILITY].s_type = UTILITY; + shipvals[UTILITY].s_width = 20; + shipvals[UTILITY].s_height = 20; + shipvals[UTILITY].s_phaserfuse = 8; + shipvals[UTILITY].s_repair = 120; + + shipvals[PATROL].s_phaserdamage = 50; + shipvals[PATROL].s_torpspeed = 15; + shipvals[PATROL].s_maxspeed = 13; + shipvals[PATROL].s_maxfuel = 4000; + shipvals[PATROL].s_maxarmies = 1; + shipvals[PATROL].s_maxshield = 50; + shipvals[PATROL].s_maxdamage = 40; + shipvals[PATROL].s_maxwpntemp = 1000; + shipvals[PATROL].s_maxegntemp = 1500; + shipvals[PATROL].s_type = PATROL; + shipvals[PATROL].s_width = 20; + shipvals[PATROL].s_height = 20; + shipvals[PATROL].s_phaserfuse = 8; + shipvals[PATROL].s_repair = 50; + + shipvals[PUCK].s_phaserdamage = 75; + shipvals[PUCK].s_torpspeed = 16; + shipvals[PUCK].s_maxspeed = 12; + shipvals[PUCK].s_maxfuel = 5000; + shipvals[PUCK].s_maxarmies = 2; + shipvals[PUCK].s_maxshield = 75; + shipvals[PUCK].s_maxdamage = 75; + shipvals[PUCK].s_maxwpntemp = 1000; + shipvals[PUCK].s_maxegntemp = 1000; + shipvals[PUCK].s_type = PUCK; + shipvals[PUCK].s_width = 20; + shipvals[PUCK].s_height = 20; + shipvals[PUCK].s_phaserfuse = 10; + shipvals[PUCK].s_repair = 80; +#endif } /******************************************************************************/ Index: mswindow.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v retrieving revision 1.82 retrieving revision 1.83 diff -u -d -r1.82 -r1.83 --- mswindow.c 27 Apr 2007 10:04:19 -0000 1.82 +++ mswindow.c 17 May 2007 08:49:49 -0000 1.83 @@ -323,11 +323,11 @@ }; #ifndef SCALE_BITMAPS -#define BIGBITMAP_WIDTH 240 -#define BIGBITMAP_HEIGHT 240 +#define BIGBITMAP_WIDTH 500 +#define BIGBITMAP_HEIGHT 500 #else -static int BIGBITMAP_WIDTH = 240; -static int BIGBITMAP_HEIGHT = 240; +static int BIGBITMAP_WIDTH = 500; +static int BIGBITMAP_HEIGHT = 500; #endif struct BitmapList @@ -3607,6 +3607,50 @@ ReleaseDC (win->hwnd, hdc); } +//Draw a rectangle +void +W_WriteRectangle (W_Window window, + int x, + int y, + int width, + int height, + int dashed, + W_Color color) +{ + POINT points[4]; + DBHEADER_VOID; + + x += win->border; + y += win->border; + + points[0].x = x; + points[0].y = y; + points[1].x = x + width; + points[1].y = y; + points[2].x = x + width; + points[2].y = y + height; + points[3].x = x; + points[3].y = y + height; + + if (NetrekPalette) + { + SelectPalette (hdc, NetrekPalette, FALSE); + RealizePalette (hdc); + } + if (dashed) + { + SetBkColor (hdc, colortable[BLACK].rgb); + SelectObject (hdc, colortable[color].dashedpen); + } + else + SelectObject (hdc, colortable[color].pen); + SelectObject (hdc, GetStockObject (NULL_BRUSH)); + + Polygon (hdc, points, 4); + + if (!sdb || !doubleBuffering || !ingame) + ReleaseDC (win->hwnd, hdc); +} //Put some text in a window. This is a straight ExtTextOut call if it's a //graphics window, a ExtTextOut call with mapped coordinates if it's a Index: newwin.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v retrieving revision 1.63 retrieving revision 1.64 diff -u -d -r1.63 -r1.64 --- newwin.c 13 Apr 2007 09:10:16 -0000 1.63 +++ newwin.c 17 May 2007 08:49:49 -0000 1.64 @@ -36,6 +36,23 @@ static int line = 0; int MaxMotdLine = 0; +#ifdef PARADISE +#define LINESPERPAGE 38 +#else +#define LINESPERPAGE 28 +#endif + +#ifdef PARADISE +#define S_MOTD 0 +#define S_SYSDEF 1 +#define S_CREDITS 2 +#define S_MAX 3 +static void showPics (W_Window win, int atline); +int newMotdStuff = 0; /* set to 1 when new motd packets arrive */ +static struct piclist *motdPics = NULL; +static struct piclist **motd_buftail = &motdPics; +#endif + /* if a motd line from the server is this, the client will junk all motd * * data it currently has. New data may be received */ #define MOTDCLEARLINE "\033\030CLEAR_MOTD\000" @@ -54,6 +71,10 @@ void loadbitmapsM (void); void loadbitmapsG (void); void loadbitmapsHR (void); +#ifdef PARADISE +void loadbitmapsparadise (void); +void loadparadisethings (void); +#endif void loadweaponsC (void); void loadplanetsC (void); @@ -429,8 +450,41 @@ } } +#ifdef PARADISE /******************************************************************************/ -/*** loadweaponsHR() - high quality ship bitmaps, 80x80 +/*** loadbitmapsParadise() +/******************************************************************************/ +void loadbitmapsParadise() +{ + int j, k; + + if ( access("bitmaps/shiplib/paradise_ships.bmp", R_OK) == 0 ) + { + paradise_ship_bitmaps = + W_StoreBitmap3 ("bitmaps/shiplib/paradise_ships.bmp", BMP_SHIP_WIDTH * NUM_PSHIP_TYPES, + BMP_SHIP_HEIGHT * NUMTEAMS, BMP_PSHIP, w, LR_MONOCHROME); + } + else // No paradise ship bitmaps, doh! + { + LineToConsole("Failed to load paradise bitmaps, defaulting to cruiser for all ships.\n"); + noParadiseBitmaps = 1; + return; + } + + for (j = 0; j < NUM_PSHIP_TYPES; j++) + { + for (k = 0; k < NUMTEAMS; k++) + { + paradise_ships[j][k] = + W_PointBitmap2 (paradise_ship_bitmaps, j, k, BMP_SHIP_WIDTH, + BMP_SHIP_HEIGHT); + } + } +} +#endif + +/******************************************************************************/ +/*** loadbitmapsHR() - high quality ship bitmaps, 80x80 /******************************************************************************/ void loadbitmapsHR() { @@ -767,6 +821,29 @@ LR_DEFAULTCOLOR); } +#ifdef PARADISE +/******************************************************************************/ +/*** loadparadisethings() - misc paradise art like stars, wormholes, etc +/******************************************************************************/ +void loadparadisethings (void) +{ + int i; + + base_star_bitmap = + W_StoreBitmap3 ("bitmaps/misclib/color/star.bmp", BMP_STAR_WIDTH, + BMP_STAR_HEIGHT * STAR_VIEWS, BMP_STAR, w, + LR_DEFAULTCOLOR); + for (i = 0; i < STAR_VIEWS; i++) + star_bitmap[i] = + W_PointBitmap2 (base_star_bitmap, 0, i, BMP_STAR_WIDTH, BMP_STAR_HEIGHT); + + star_mbitmap = + W_StoreBitmap3 ("bitmaps/misclib/color/starm.bmp", BMP_MSTAR_WIDTH, + BMP_MSTAR_HEIGHT, BMP_MSTAR, mapw, + LR_DEFAULTCOLOR); +} +#endif + /******************************************************************************/ /*** handleMessageWindowKeyDown() /******************************************************************************/ @@ -852,7 +929,11 @@ W_SetWindowKeyDownHandler (warnw, handleMessageWindowKeyDown); +#ifdef PARADISE + planetw = W_MakeTextWindow ("planet", TWINSIDE + 2 * THICKBORDER + 10, 10, 70, MAXPLANETS + 8, baseWin, 2); +#else planetw = W_MakeTextWindow ("planet", TWINSIDE + 2 * THICKBORDER + 10, 10, 57, MAXPLANETS + 3, baseWin, 2); +#endif W_SetWindowExposeHandler (planetw, planetlist); rankw = W_MakeTextWindow ("rank", 10, 300, 80, NUMRANKS + 9, baseWin, 2); @@ -1149,6 +1230,9 @@ rotatePlanets = booleanDefault ("rotatePlanets", rotatePlanets); loadplanetsC(); // Always load new color planet bitmaps..for now loadmplanetsC(); +#ifdef PARADISE + loadparadisethings(); +#endif switch (planetBitmap) // Case 3 = new color, but we never use Planlib { case 1: @@ -1196,6 +1280,9 @@ loadbitmapsM(); break; } +#ifdef PARADISE + loadbitmapsParadise(); +#endif } else /* Load all bitmaps */ { @@ -1205,6 +1292,9 @@ loadbitmapsT(); loadbitmapsM(); loadbitmapsHR(); +#ifdef PARADISE + loadbitmapsParadise(); +#endif } #ifdef BEEPLITE @@ -1535,6 +1625,13 @@ updatedeath (); if (W_IsMapped (playerw)) UpdatePlayerList (); +#ifdef PARADISE + if (newMotdStuff) + { + showMotdWin (w, line); + //showValues(mapw); + } +#endif showTimeLeft (elapsed, autoQuit); lasttime = time (0); } @@ -1605,6 +1702,29 @@ case 'o': *s_type = STARBASE; break; +#ifdef PARADISE + case 'j': + *s_type = JUMPSHIP; + break; + case 'f': + *s_type = FLAGSHIP; + break; + case 'w': + *s_type = WARBASE; + break; + case 'l': + *s_type = LIGHTCRUISER; + break; + case 'v': + *s_type = CARRIER; + break; + case 'u': + *s_type = UTILITY; + break; + case 'p': + *s_type = PATROL; + break; +#endif case ' ': switch (me->p_team) { @@ -1653,10 +1773,10 @@ resetting = 1; break; case 'f': /* Scroll motd forward */ - line = line + 28; + line = line + LINESPERPAGE; if (line > MaxMotdLine) { - line = line - 28; + line = line - LINESPERPAGE; break; } W_ClearWindow (w); @@ -1665,13 +1785,14 @@ case 'b': /* Scroll motd backward */ if (line == 0) break; - line = line - 28; + line = line - LINESPERPAGE; if (line < 0) line = 0; W_ClearWindow (w); showMotdWin (w, line); break; - case 'F': /* Scroll motd forward */ +#ifndef PARADISE /* Paradise MOTD requires paging */ + case 'F': /* Scroll motd a bit forwards */ line = line + 4; if (line > MaxMotdLine) { @@ -1681,7 +1802,7 @@ W_ClearWindow (w); showMotdWin (w, line); break; - case 'B': /* Scroll motd backward */ + case 'B': /* Scroll motd a bit backwards */ if (line == 0) break; line = line - 4; @@ -1690,6 +1811,7 @@ W_ClearWindow (w); showMotdWin (w, line); break; +#endif } } /* No break, we just fall through */ @@ -1942,18 +2064,30 @@ int count; char buf[128]; +#ifdef PARADISE + newMotdStuff = 0; /* clear the flag */ +#endif + sprintf (buf, "--- %s ---", (char *) query_cowid ()); length = strlen (buf); center = TWINSIDE / 2 - (length * W_Textwidth) / 2; +#ifndef PARADISE /* no space for client header in paradise */ W_WriteText (motdwin, center, W_Textheight, textColor, buf, length, W_BoldFont); +#endif sprintf (buf, CBUGS); length = strlen (buf); center = TWINSIDE / 2 - (length * W_Textwidth) / 2; +#ifndef PARADISE /* no space for client header in paradise */ W_WriteText (motdwin, center, 3 * W_Textheight, textColor, buf, length, W_RegularFont); +#endif +#ifdef PARADISE + top = 0; +#else top = 10; +#endif if (first) { @@ -1977,7 +2111,8 @@ } data = data->next; } - count = 28; /* Magical # of lines to + + count = LINESPERPAGE; /* Magical # of lines to * display */ for (i = top; i < 50; i++) { @@ -2000,10 +2135,50 @@ if (count <= 0) break; } - +#ifdef PARADISE + if (motdwin == w) { + W_WriteText(mapw, GWINSIDE/2 - W_Textwidth * strlen(blk_refitstring) / 2, GWINSIDE - 20, textColor, blk_refitstring, + strlen(blk_refitstring), W_RegularFont); + } + showPics(motdwin, atline); +#endif showValues (data); } +/******************************************************************************/ +/*** showPics() */ +/******************************************************************************/ +#ifdef PARADISE +static void +showPics(W_Window win, int atline) +{ + struct piclist *temp; + + temp = motdPics; + + while (temp != NULL) { + if (atline/LINESPERPAGE == temp->page) { /* hack for paging not working */ + if (temp->thepic) + W_WriteBitmap(temp->x, temp->y, temp->thepic, foreColor, win); + else { + W_MakeLine(win, temp->x, temp->y, + temp->x + temp->width - 1, temp->y + temp->height - 1, W_Grey); + W_MakeLine(win, temp->x, temp->y + temp->height - 1, + temp->x + temp->width - 1, temp->y, W_Grey); + W_MakeLine(win, temp->x, temp->y, + temp->x + temp->width - 1, temp->y, W_Grey); + W_MakeLine(win, temp->x, temp->y, + temp->x, temp->y + temp->height - 1, W_Grey); + W_MakeLine(win, temp->x, temp->y + temp->height - 1, + temp->x + temp->width - 1, temp->y + temp->height - 1, W_Grey); + W_MakeLine(win, temp->x + temp->width - 1, temp->y + temp->height - 1, + temp->x + temp->width - 1, temp->y, W_Grey); + } + } + temp = temp->next; + } +} +#endif /******************************************************************************/ /*** showValues() @@ -2028,7 +2203,11 @@ W_WriteText (mapw, 20, 14 * W_Textheight, textColor, msg, strlen (msg), W_RegularFont); +#ifdef PARADISE + for (i = 16; i < 50; i++) +#else for (i = 16; i < 50; i += 2) +#endif { if (data == NULL) break; @@ -2072,6 +2251,29 @@ static struct list **temp = &motddata; static int statmode = 0; /* ATM */ +#ifdef PARADISE + /* Inlined blk_parsemotd() paradise client function */ + if (strncmp("BLK: ", line, 5) == 0) { + /* See if it's a refit string.*/ + if (strncmp(&line[5], "REFIT", 5) == 0) { + strncpy(blk_refitstring, &line[10], 79); + blk_refitstring[79] = '\0'; + } + /* Check to see if it's a borgish feature being enabled. */ + else if (strncmp(&line[5], "BORGISH ", 8) == 0) { + if (strncmp(&line[13], "FRCLOAK", 7) == 0) + blk_friendlycloak = 1; + } + return; + } + if ( strncmp("\t@@b", line, 4) == 0) // Between pages + return; + /*if (!currpage || + (pagecount - 1) == currpage->page || + motdlinestate == IN_SYSDEF) */ + newMotdStuff = 1; /* set flag for event loop */ + first = 1; /* check for bold again */ +#endif if (!statmode && !strcmp (line, STATUS_TOKEN)) statmode = 1; if (!statmode) @@ -2097,6 +2299,41 @@ temp = &((*temp)->next); } +#ifdef PARADISE +/******************************************************************************/ +/*** newMotdPic() +/******************************************************************************/ +void +newMotdPic(int x, int y, int width, int height, char *bits, int page) +{ + struct piclist *tmp; + struct motd_pic_spacket dummy; + + if ((width + 7) / 8 * height > sizeof(dummy.bits) && bits) + { + LineToConsole("MOTD picture from server is too big! %dx%d couldn't possibly fit in the %d data bytes of the packet\n", + width, height, (int) sizeof(dummy.bits)); + return; + } + + if ((currpage && page == currpage->page) || page == 0) + { + newMotdStuff = 1; /* set flag for event loop */ + first = 1; /* check for bold again */ + } + + tmp = (*motd_buftail) = (struct piclist *) malloc(sizeof(struct piclist)); + tmp->next = NULL; + tmp->x = x; + tmp->y = y - 112; /* 112 is magic number of height of the paradise header + image which we do NOT have */ + tmp->width = width; + tmp->height = height; + tmp->thepic = bits ? W_StoreBitmap(width, height, bits, w) : 0; + tmp->page = page; + motd_buftail = &(tmp->next); +} +#endif /******************************************************************************/ /*** getResources() Index: input.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/input.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- input.c 16 May 2007 00:05:15 -0000 1.39 +++ input.c 17 May 2007 08:49:48 -0000 1.40 @@ -1292,6 +1292,43 @@ localflags &= ~(PFREFIT); return; break; +#ifdef PARADISE + case 'j': + sendRefitReq (JUMPSHIP); + localflags &= ~(PFREFIT); + return; + break; + case 'f': + sendRefitReq (FLAGSHIP); + localflags &= ~(PFREFIT); + return; + break; + case 'w': + sendRefitReq (WARBASE); + localflags &= ~(PFREFIT); + return; + break; + case 'l': + sendRefitReq (LIGHTCRUISER); + localflags &= ~(PFREFIT); + return; + break; + case 'v': + sendRefitReq (CARRIER); + localflags &= ~(PFREFIT); + return; + break; + case 'u': + sendRefitReq (UTILITY); + localflags &= ~(PFREFIT); + return; + break; + case 'p': + sendRefitReq (PATROL); + localflags &= ~(PFREFIT); + return; + break; +#endif default: localflags &= ~(PFREFIT); return; Index: local.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v retrieving revision 1.101 retrieving revision 1.102 diff -u -d -r1.101 -r1.102 --- local.c 14 May 2007 02:56:41 -0000 1.101 +++ local.c 17 May 2007 08:49:48 -0000 1.102 @@ -38,6 +38,9 @@ static int clearline[4][MAXPLAYER + 2 * MAXPLAYER]; #endif static int planet_frame = 0; +#ifdef PARADISE +static int star_frame = 0; +#endif static int star_updates = 0; static int last_speed = 0; static int streaks_on = 0; @@ -129,10 +132,10 @@ if (TWINSIDE == 0) return; - imax = 5 * STARSIDE / TWINSIDE + 1; + imax = 10 * STARSIDE / TWINSIDE + 1; if (imax > MAXSECTORS) imax = MAXSECTORS; - jmax = 5 * STARSIDE / TWINSIDE + 1; + jmax = 10 * STARSIDE / TWINSIDE + 1; if (jmax > MAXSECTORS) jmax = MAXSECTORS; kmax = 16 * TWINSIDE / STARSIDE * TWINSIDE / STARSIDE; @@ -545,7 +548,29 @@ dx = dx / scaleFactor + TWINSIDE / 2; dy = dy / scaleFactor + TWINSIDE / 2; - + +#ifdef PARADISE + if (PL_TYPE(*l) == PLSTAR) + { + int j = star_frame * 10 / server_ups; + if ((j >= STAR_VIEWS - 1) || (j < 0)) + { + j = 0; + star_frame = 0; + } + W_WriteScaleBitmap (dx - (BMP_STAR_WIDTH / 2) * SCALE / scaleFactor, + dy - (BMP_STAR_HEIGHT / 2) * SCALE / scaleFactor, + BMP_STAR_WIDTH * SCALE / scaleFactor, + BMP_STAR_HEIGHT * SCALE / scaleFactor, + BMP_STAR_WIDTH, + BMP_STAR_HEIGHT, + 0, + star_bitmap[j], + planetColor (l), + w); + } + else +#endif if (planetBitmap == 3) { W_WriteScaleBitmap (dx - (BMP_PLANET_WIDTH / 2) * SCALE / scaleFactor, @@ -553,8 +578,8 @@ BMP_PLANET_WIDTH * SCALE / scaleFactor, BMP_PLANET_HEIGHT * SCALE / scaleFactor, BMP_CPLANET_WIDTH, - BMP_CPLANET_HEIGHT, - 0, + BMP_CPLANET_HEIGHT, + 0, planetBitmapC (l), planetColor (l), w); @@ -573,7 +598,7 @@ BMP_PLANET_WIDTH * SCALE / scaleFactor, BMP_PLANET_HEIGHT * SCALE / scaleFactor, BMP_PLANET_WIDTH, - BMP_PLANET_HEIGHT, + BMP_PLANET_HEIGHT, 0, getPlanetBitmap (l), planetColor (l), @@ -614,6 +639,9 @@ /* Allow army display if player/observer is orbitting a planet, or alternatively if observer is locked onto a planet, or is show_army_count feature packet is on */ if ((showArmy == 1 || showArmy == 3) && (l->pl_info & me->p_team) +#ifdef PARADISE + && (PL_TYPE(*l) != PLSTAR) +#endif && (F_show_army_count || ( (me->p_flags & PFORBIT) && (F_sp_generic_32 ? me->pl_orbit : get_closest_planet(me->p_x, me->p_y)) == l->pl_no) || ((me->p_flags & PFPLLOCK) && (me->p_flags & PFOBSERV) && (me->p_planet == l->pl_no)) )) @@ -669,6 +697,9 @@ clearcount++; } planet_frame++; +#ifdef PARADISE + star_frame++; +#endif } @@ -719,6 +750,7 @@ int dx, dy, px, py, wx, wy, tx, ty, lx, ly; int new_dx, new_dy; int startx, starty, endx, endy; + int type; W_Icon (*ship_bits)[SHIP_VIEWS]; W_Icon (*ship_bitsHR); @@ -1021,6 +1053,49 @@ } } + type = j->p_ship.s_type; +#ifdef PARADISE + // We missing paradise bitmaps? + if (noParadiseBitmaps) + type = CRUISER; + // If it's a paradise ship, we only have 1 bitmap set + // so let's use it, rotating bitmaps realtime. + if (type >= PARADISE_SHIP_OFFSET) + { + int pos; + + switch (j->p_team) + { + case FED: + pos = 0; + break; + case ROM: + pos = 4; + break; + case KLI: + pos = 2; + break; + case ORI: + pos = 3; + break; + default: // Ind + pos = 1; + break; + } + W_WriteScaleBitmap (dx - (j->p_ship.s_width / 2) * SCALE / scaleFactor, + dy - (j->p_ship.s_height / 2) * SCALE / scaleFactor, + j->p_ship.s_width * SCALE / scaleFactor, + j->p_ship.s_height * SCALE / scaleFactor, + BMP_SHIP_WIDTH, + BMP_SHIP_HEIGHT, + (360 * j->p_dir/255), + paradise_ships[type - PARADISE_SHIP_OFFSET][pos], + playerColor (j), + w); + } + else + { +#endif if (colorClient != 4) { W_WriteScaleBitmap (dx - (j->p_ship.s_width / 2) * SCALE / scaleFactor, @@ -1033,8 +1108,8 @@ // pointing up position. If not, find the correct bitmap in // the ship rosette and set angle to 0. fullBitmapRotation ? (360 * j->p_dir/255) : 0, - fullBitmapRotation ? ship_bits[j->p_ship.s_type][0] : - ship_bits[j->p_ship.s_type][rosette (j->p_dir)], + fullBitmapRotation ? ship_bits[type][0] : + ship_bits[type][rosette (j->p_dir)], playerColor (j), w); } @@ -1047,10 +1122,13 @@ BMP_SHIP_WIDTH_HR, BMP_SHIP_HEIGHT_HR, (360 * j->p_dir/255), // Converted to angle - ship_bitsHR[j->p_ship.s_type], + ship_bitsHR[type], playerColor (j), w); } +#ifdef PARADISE + } +#endif /* If the ship is not yet fully cloaked, draw the cloak icon on top of the ship icon */ @@ -1601,12 +1679,19 @@ } else { +#ifdef PARADISE + /* Paradise servers changed the ship cap protocol for + phaser damage :( */ + tx = (int) (j->p_ship.s_phaserdamage * Cos[php->ph_dir]); + + ty = (int) (j->p_ship.s_phaserdamage * Sin[php->ph_dir]); +#else tx = (int) (PHASEDIST * j->p_ship.s_phaserdamage / 100 * Cos[php->ph_dir]); ty = (int) (PHASEDIST * j->p_ship.s_phaserdamage / 100 * Sin[php->ph_dir]); - +#endif tx = (j->p_x + tx - me->p_x) / scaleFactor + TWINSIDE / 2; ty = (j->p_y + ty - me->p_y) / scaleFactor + TWINSIDE / 2; } Index: findslot.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/findslot.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- findslot.c 13 Apr 2007 07:12:24 -0000 1.9 +++ findslot.c 17 May 2007 08:49:48 -0000 1.10 @@ -33,6 +33,10 @@ #define WAITTITLE 15 /* height of title for wait * window */ +#ifdef PARADISE +extern int newMotdStuff; /* from newwin.c */ +#endif + /******************************************************************************/ /*** mapWaitWin() ***/ /******************************************************************************/ @@ -157,6 +161,10 @@ LineToConsole ("Damn, We've been ghostbusted!\n"); terminate (0); } +#ifdef PARADISE + if (newMotdStuff) + showMotdWin(motdWin, WaitMotdLine); +#endif while (W_EventsPending ()) { W_NextEvent (&event); Index: planetlist.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/planetlist.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- planetlist.c 17 Mar 2007 01:21:49 -0000 1.7 +++ planetlist.c 17 May 2007 08:49:49 -0000 1.8 @@ -18,6 +18,11 @@ #include "data.h" #include "proto.h" +/* Prototypes */ +#ifdef PARADISE +static void planet_list_paradise (void); +static void print_planet (W_Window wind, int line, struct planet * ); +#endif static char priorplanets[MAXPLANETS][BUFSIZ]; int planet_row[MAXPLANETS]; /* planets location in current plist */ @@ -39,6 +44,12 @@ void planetlist (void) { +#ifdef PARADISE + if (paradise) + planet_list_paradise(); + else + { +#else register int i; char buf[BUFSIZ]; @@ -51,8 +62,197 @@ for (i = 0; i < MAXPLANETS; i++) strcpy(priorplanets[i], ""); updatePlanetw (); +#endif +#ifdef PARADISE + } +#endif +} + +#ifdef PARADISE +int mask_to_idx(int m) +{ + switch(m) { + case NOBODY: + return -1; + case FED: + return 0; + case ROM: + return 1; + case KLI: + return 2; + case ORI: + return 3; + default: + return number_of_teams; + } } +/*This function provides the planet list for a paradise server version 2.0 */ +static void planet_list_paradise (void) +{ + typedef struct planet *plptr; + + int k = 0; /* for row number */ + int i, team_pnum; /* looping var */ + plptr j; /* to point to a planet */ + char buf[100]; /* to sprintf into */ + W_Window wind; + extern int number_of_teams; + plptr **team_p; + int *team_pcount; + + wind = planetw; + + /* this malloc stuff will handle any number of teams/races */ + + /* team's planet counters */ + team_pcount = (int *) malloc((number_of_teams + 2) * sizeof(int)); + for (i = 0; i < number_of_teams + 2; i++) + team_pcount[i] = 0; + + if (sortPlanets) { + /* make some memory */ + team_p = (plptr **) malloc((number_of_teams + 2) * sizeof(struct planet *)); + for (i = 0; i < (number_of_teams + 2); i++) + team_p[i] = (plptr *) malloc(nplanets * sizeof(struct planet *)); + + /* loop thru and put proper team planeter point on each planet */ + for (i = 0, j = &planets[i]; i < nplanets; i++, j++) { + k = mask_to_idx(j->pl_owner) + 1; /* which team gets planet */ + team_p[k][team_pcount[k]] = j; + team_pcount[k]++; + } + + /* go thru each teams planet list and display */ + for (i = 0, k = 0; i < (number_of_teams + 2); i++) { + for (team_pnum = 0; team_pnum < team_pcount[i]; team_pnum++, k++) { + + j = team_p[i][team_pnum]; + /* (nplanets+13)/2 is the height of window; from newwin.c */ + if (k == 0 || k >= ((nplanets + 13) / 2)) { + if (k != 0) + continue; + //wind = planetw2; + sprintf(buf, "Planet name sctr own armies RESOURCES SURFC ATMOS VISIT TIME"); + W_WriteText(wind, 2, 1, textColor, buf, strlen(buf), + W_RegularFont); + k = 2; + } + print_planet(wind, k, j); + } /* end of 2nd for */ + if (team_pcount[i] > 0) + k++; + } /* end of 1st for */ + + for (i = 0; i < (number_of_teams + 2); i++) + free(team_p[i]); + free(team_p); + } else { /* do the original alpa only sort planet list */ + + for (i = 0, j = &planets[i]; i < nplanets; i++, j++, k++) { + if (i == 0 || i == nplanets / 2) { + + sprintf(buf, "Planet name sctr own armies RESOURCES SURFC ATMOS VISIT TIME"); + + if (i != 0) { + continue; + //wind = planetw2; + } + W_WriteText(wind, 2, 1, textColor, buf, strlen(buf), + W_RegularFont); + k = 2; + } + team_pcount[mask_to_idx(j->pl_owner) + 1]++; + print_planet(wind, k, j); + } + } + + k++; + for (i = 0; i < (number_of_teams + 1); i++) { + W_Color cur_color; + + cur_color = shipCol[i]; + //sprintf(buf, "%s: ", teaminfo[i-1].shortname); + sprintf(buf, "%s : ", teamname[i]); + W_WriteText(wind, i * 7 + 2, k, cur_color, buf, strlen(buf), + W_RegularFont); + sprintf(buf, " %-2d", team_pcount[i]); + W_WriteText(wind, i * 7 + 2, k + 1, cur_color, buf, strlen(buf), + W_RegularFont); + } + + free(team_pcount); + +} /* end of planet_list_paradise */ + +/****************************** print_planet() ************************/ +static void print_planet (W_Window wind, int line, struct planet *j) +{ + char buf[100]; /* to sprintf into */ + + sprintf(buf, "%-16s %d-%d", j->pl_name, (j->pl_x / GRIDSIZE) + 1, + (j->pl_y / GRIDSIZE) + 1); + W_WriteText(wind, 2, line, textColor, buf, strlen(buf), + W_RegularFont); + + if (j->pl_info & me->p_team) { + if (PL_TYPE(*j) == PLSTAR) { /* if planet actually a star */ + W_WriteText(wind, 24, line, textColor, "---S T A R---", 13, + W_RegularFont); + } else if (PL_TYPE(*j) == PLWHOLE) { /* if wormhole... */ + W_WriteText(wind, 24, line, textColor, "---W O R M H O L E---", 21, + W_RegularFont); + } else { /* else planet not a star */ + char *s = NULL; + + switch (j->pl_flags & PLATMASK) { + case PLPOISON: + s = "TOXC"; + break; + case PLATYPE3: + s = "TNTD"; + break; + case PLATYPE2: + s = "THIN"; + break; + case PLATYPE1: + s = "STND"; + break; + }; + sprintf(buf, "%3s %3d %c%c%c%c %c%c%c %4s", + teamname[j->pl_owner], + //teaminfo[mask_to_idx(j->pl_owner)].shortname, + j->pl_armies, + (j->pl_flags & PLREPAIR ? 'R' : ' '), + (j->pl_flags & PLFUEL ? 'F' : ' '), + (j->pl_flags & PLAGRI ? 'A' : ' '), + (j->pl_flags & PLSHIPYARD ? 'S' : ' '), + (j->pl_flags & PLDILYTH ? 'D' : ' '), + (j->pl_flags & PLMETAL ? 'M' : ' '), + (j->pl_flags & PLARABLE ? 'A' : ' '), + s); + + W_WriteText(wind, 24, line, planetColor(j), buf, strlen(buf), + planetFont(j)); + + sprintf(buf, "%c%c%c%c %3ld", /* Remove team_bit_string reference */ + (j->pl_info & FED ? 'F' : ' '), + (j->pl_info & ROM ? 'R' : ' '), + (j->pl_info & KLI ? 'K' : ' '), + (j->pl_info & ORI ? 'O' : ' '), + (me->p_team == j->pl_owner ? 0 : (status2->clock - j->pl_timestamp))); + + W_WriteText(wind, 64, line, planetColor(j), buf, strlen(buf), + planetFont(j)); + } + } else { + sprintf(buf, "--- No info; Scout me ---"); + W_WriteText(wind, 24, line, textColor, buf, strlen(buf), + W_RegularFont); + } +} /* end of print_planet */ +#endif + /* Update only lines that have changed */ void updatePlanetw (void) Index: death.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/death.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- death.c 28 Apr 2007 12:09:51 -0000 1.19 +++ death.c 17 May 2007 08:49:48 -0000 1.20 @@ -122,6 +122,14 @@ shipnos[me->p_whodead]); break; case KPLANET: +#ifdef PARADISE + /* different message if killed by a star [BDyess] */ + if(planets[me->p_whodead].pl_flags && PLSTAR) + sprintf (deathmessage, + "You were burned to a crisp by %s [star]", + planets[me->p_whodead].pl_name); + else +#endif sprintf (deathmessage, "You were killed by planetary fire from %s (%c).", planets[me->p_whodead].pl_name, @@ -217,12 +225,30 @@ case KBADBIN: strcpy (deathmessage, "Your netrek executable didn't verify correctly."); break; +#ifdef PARADISE + /* Unfortunately the numbering of whydead messages is inconsistent between + paradise and Vanilla */ + case KMISSILE: + sprintf (deathmessage, "You were killed by a missile from %s (%c%c).", + players[me->p_whodead].p_name, + teamlet[players[me->p_whodead].p_team], + shipnos[me->p_whodead]); + break; +#else case KTORP2: strcpy (deathmessage, "You were killed by detonated torpedo."); break; +#endif +#ifdef PARADISE + case KASTEROID: + /* asteroid death [BDyess] */ + sprintf(deathmessage, "You were smashed to bits by an asteroid."); + break; +#else case KSHIP2: strcpy (deathmessage, "You were killed by chain reaction explosion."); break; +#endif case KPLASMA2: strcpy (deathmessage, "You were killed by zapped plasma."); break; Index: playerlist.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/playerlist.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- playerlist.c 16 Mar 2007 01:44:24 -0000 1.12 +++ playerlist.c 17 May 2007 08:49:49 -0000 1.13 @@ -106,8 +106,13 @@ static int plistPos[MAXPLAYER]; static int plistWidth = 0; static int plist2Width = 0; +#ifdef PARADISE +static char *my_classes[NUM_TYPES] = { + "SC", "DD", "CA", "BB", "AS", "SB", "GA", "JS", "FL", "WB", "CL", "CV", "UT", "PT", "PU" }; +#else static char *my_classes[NUM_TYPES] = { "SC", "DD", "CA", "BB", "AS", "SB", "GA", "AT" }; +#endif /* Local Functions */ Index: socket.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/socket.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- socket.c 16 May 2007 00:05:16 -0000 1.32 +++ socket.c 17 May 2007 08:49:49 -0000 1.33 @@ -945,7 +945,7 @@ #ifdef PARADISE case SP_GPARAM: switch ((unsigned char) bufptr[1]) { -/* case 0: + case 0: size = sizeof(struct gp_sizes_spacket); break; case 1: @@ -968,11 +968,12 @@ break; case 7: size = sizeof(struct gp_teamplanet_spacket); - break;*/ + break; default: size = 0; break; } + break; case SP_PARADISE_EXT1: switch ((unsigned char) bufptr[1]) { case SP_PE1_MISSING_BITMAP: @@ -985,6 +986,7 @@ size = 0; break; } + break; #endif case SP_S_MESSAGE: size = ((unsigned char) bufptr[4]); /* IMPORTANT Changed */ @@ -1912,6 +1914,10 @@ handleLogin (struct login_spacket *packet) { loginAccept = packet->accept; +#ifdef PARADISE + if ((packet->pad2 == 69) && (packet->pad3 == 42)) + paradise = 1; +#endif if (packet->accept) { /* no longer needed .. we have it in xtrekrc bcopy(packet->keymap, @@ -2526,7 +2532,7 @@ pl->pl_y = ntohl (packet->y); strcpy (pl->pl_name, packet->name); pl->pl_namelen = strlen (packet->name); - pl->pl_flags |= (PLREDRAW | PLCLEAR); + pl->pl_flags |= PLREDRAW; reinitPlanets = 1; #ifdef ROTATERACE @@ -2719,7 +2725,7 @@ height = ntohs(packet->height); page = ntohs(packet->page); - //newMotdPic(x, y, width, height, (char *) packet->bits, page); + newMotdPic(x, y, width, height, (char *) packet->bits, page); } void handleStats2 (struct stats_spacket2 *packet) @@ -2805,7 +2811,7 @@ return; } #endif -/* + if(first_planet_packet) { first_planet_packet = 0; @@ -2832,7 +2838,7 @@ if (infomapped && infotype == PLANETTYPE && ((struct planet *) infothing)->pl_no == packet->pnum) infoupdate = 1; -*/ + } void handleTerrainInfo2 (struct terrain_info_packet2 *pkt) @@ -3092,38 +3098,294 @@ } } +void handleGPsizes (struct gp_sizes_spacket *pkt) +{ +/* + free_ranks(); + free_royal(); + + free_teams(); + free_torps(); + free_phasers(); + free_plasmas(); + free_thingies(); + + nplayers = pkt->nplayers; + number_of_teams = pkt->nteams; + // shiptypes + nranks2 = pkt->nranks; + nroyals = pkt->nroyal; + nphasers = pkt->nphasers; + ntorps = pkt->ntorps; + nplasmas = pkt->nplasmas; + npthingies = pkt->nthingies; + ngthingies = pkt->gthingies; + + // gwidth + // flags + + load_generic_teams(); + + reinit_ranks(); + reinit_royal(); + + resize_players(); + initialize_torps(); + initialize_phasers(); + initialize_plasmas(); + initialize_thingies(); +*/ +} + +void handleGPteam (struct gp_team_spacket *pkt) +{ +/* + struct teaminfo_s *currteam; + + if ((int) pkt->index >= number_of_teams) { + fprintf(stderr, "Team #%d %s is out of range (0..%d)\n", pkt->index, + pkt->teamname, number_of_teams); + return; + } + currteam = &teaminfo[pkt->index]; + + currteam->letter = pkt->letter; + + strncpy(currteam->shortname, pkt->shortname, 3); + currteam->shortname[3] = 0; + + strncpy(currteam->name, pkt->teamname, sizeof(currteam->name) - 1); + currteam->name[sizeof(currteam->name) - 1] = 0; +*/ +} + +void handleGPteamlogo (struct gp_teamlogo_spacket *pkt) +{ +/* + static char buf[13 * 99]; // 99x99 + static int curr_height = 0; + static int lwidth, lheight; + static int teamindex; + int pwidth; + + if ((unsigned) pkt->teamindex >= number_of_teams) { + fprintf(stderr, "Team #%d is out of range (0..%d)\n", pkt->teamindex, + number_of_teams); + return; + } + if (pkt->y != curr_height) { + fprintf(stderr, "Bad gp_teamlogo packet sequence y(%d) != curr_height(%d)\n", + pkt->y, curr_height); + curr_height = 0; + return; + } + if (curr_height) { + if (lwidth != pkt->logowidth || lheight != pkt->logoheight || + teamindex != pkt->teamindex) { + fprintf(stderr, "gp_teamlogo packet sequence error, %d!=%d || %d!=%d || %d!=%d\n", + lwidth, pkt->logowidth, lheight, pkt->logoheight, + teamindex, pkt->teamindex); + curr_height = 0; + return; + } + } else { + teamindex = pkt->teamindex; + lwidth = pkt->logowidth; + lheight = pkt->logoheight; + if (lwidth > 99 || lheight > 99) { + fprintf(stderr, "logo too big (%dx%d), rejecting\n", lwidth, lheight); + curr_height = 0; + return; + } + } + pwidth = (lwidth - 1) / 8 + 1; + memcpy(buf + pwidth * curr_height, pkt->data, + (unsigned int)(pwidth * pkt->thisheight)); + curr_height += pkt->thisheight; + + if (curr_height >= lheight) { + W_FreeImage(teaminfo[teamindex].shield_logo); + teaminfo[teamindex].shield_logo = + W_BitmapToImage(lwidth, lheight, buf); + curr_height = 0; + } +*/ +} + +void handleGPshipshape (struct gp_shipshape_spacket *pkt) +{ +/* + if (pkt->race < -1 || pkt->race >= number_of_teams) { + fprintf(stderr, "race #%d out of range (-1..%d)\n", pkt->race, + number_of_teams - 1); + return; + } + if ( (int) pkt->shipno >= nshiptypes) { + fprintf(stderr, "ship class #%d out of range (0..%d)\n", pkt->shipno, + nshiptypes - 1); + return; + } +#ifdef FIXME + replace_shipshape(pkt->race, pkt->shipno, pkt->nviews, + pkt->width, pkt->height); +#endif +*/ +} + +void handleGPshipbitmap (struct gp_shipbitmap_spacket *pkt) +{ +/* + if (pkt->race < -1 || pkt->race >= number_of_teams) { + fprintf(stderr, "race #%d out of range (-1..%d)\n", pkt->race, + number_of_teams - 1); + return; + } + if ( (int) pkt->shipno >= nshiptypes) { + fprintf(stderr, "ship class #%d out of range (0..%d)\n", pkt->shipno, + nshiptypes - 1); + return; + } +#ifdef FIXME + replace_ship_bitmap(pkt->race, pkt->shipno, pkt->thisview, pkt->bitmapdata); +#endif +*/ +} + +void handleGPrank (struct gp_rank_spacket *pkt) +{ +/* + struct rank2 *curr; + if (pkt->rankn >= nranks2) { + fprintf(stderr, "rank #%d %s out of range (0..%d)\n", pkt->rankn, + pkt->name, nranks2 - 1); + return; + } + curr = &ranks2[pkt->rankn]; + free(curr->name); + + curr->genocides = htonl(pkt->genocides); + curr->di = htonl(pkt->milliDI) / 1000.0; + curr->battle = htonl(pkt->millibattle) / 1000.0; + curr->strategy = htonl(pkt->millistrat) / 1000.0; + curr->specship = htonl(pkt->millispec) / 1000.0; + curr->name = strdup(pkt->name); +*/ +} + +void handleGProyal (struct gp_royal_spacket *pkt) +{ +/* + if ((int) pkt->rankn >= nroyals) { + fprintf(stderr, "Royalty #%d %s out of range (0..%d)\n", pkt->rankn, + pkt->name, nroyals - 1); + return; + } + free(royal[pkt->rankn].name); + royal[pkt->rankn].name = strdup(pkt->name); +*/ +} + +#ifdef FIXME +static unsigned char mplanet_bits[] = { + 0xe0, 0x03, 0x18, 0x0c, 0x04, 0x10, 0x02, 0x20, 0x02, 0x20, 0x01, 0x40, + 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x02, 0x20, 0x02, 0x20, +0x04, 0x10, 0x18, 0x0c, 0xe0, 0x03, 0x00, 0x00}; +static unsigned char planet_bits[] = { + 0x00, 0xf8, 0x03, 0x00, 0x00, 0x07, 0x1c, 0x00, 0xc0, 0x00, 0x60, 0x00, + 0x20, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x02, + 0x04, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x00, 0x08, + 0x02, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x10, + 0x01, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x10, + 0x01, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x10, + 0x02, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x08, + 0x04, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x04, 0x08, 0x00, 0x00, 0x02, + 0x10, 0x00, 0x00, 0x01, 0x20, 0x00, 0x80, 0x00, 0xc0, 0x00, 0x60, 0x00, +0x00, 0x07, 0x1c, 0x00, 0x00, 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}; +#endif + +void handleGPteamplanet (struct gp_teamplanet_spacket *pkt) +{ +/* +#ifdef FIXME + { +#define TACTICALSIZE sizeof(pkt->tactical) + unsigned char tactical[TACTICALSIZE]; + int i; + int race = pkt->teamn; + + if (race < -1 || race >= number_of_teams) { + fprintf(stderr, "race #%d out of range (-1..%d)\n", race, + number_of_teams - 1); + return; + } + for (i = 0; i < TACTICALSIZE; i++) { + tactical[i] = (pkt->tactical[i] & pkt->tacticalM[i]) | + (planet_bits[i] & ~pkt->tacticalM[i]); + } + + W_FreeImage(bplanets[race + 1]); + bplanets[race + 1] = W_BitmapToImage(30, 30, tactical); + +#undef TACTICALSIZE + } + + { +#define GALACTICSIZE sizeof(pkt->galactic) + unsigned char galactic[GALACTICSIZE]; + int i; + int race = pkt->teamn; + + if (race < -1 || race >= number_of_teams) { + fprintf(stderr, "race #%d out of range (-1..%d)\n", race, + number_of_teams - 1); + return; + } + for (i = 0; i < GALACTICSIZE; i++) { + galactic[i] = (pkt->galactic[i] & pkt->galacticM[i]) | + (mplanet_bits[i] & ~pkt->galacticM[i]); + } + + W_FreeImage(mbplanets[race + 1]); + mbplanets[race + 1] = W_BitmapToImage(16, 16, galactic); + +#undef GALACTICSIZE + } +#endif +*/ +} + void handleGameparams (struct gameparam_spacket *packet) { - /*switch (pkt->subtype) { + switch (packet->subtype) { case 0: - handleGPsizes((struct gp_sizes_spacket *) pkt); + handleGPsizes ((struct gp_sizes_spacket *) packet); break; case 1: - handleGPteam((struct gp_team_spacket *) pkt); + handleGPteam ((struct gp_team_spacket *) packet); break; case 2: - handleGPteamlogo((struct gp_teamlogo_spacket *) pkt); + handleGPteamlogo ((struct gp_teamlogo_spacket *) packet); break; case 3: - handleGPshipshape((struct gp_shipshape_spacket *) pkt); + handleGPshipshape ((struct gp_shipshape_spacket *) packet); break; case 4: - handleGPshipbitmap((struct gp_shipbitmap_spacket *) pkt); + handleGPshipbitmap ((struct gp_shipbitmap_spacket *) packet); break; case 5: - handleGPrank((struct gp_rank_spacket *) pkt); + handleGPrank ((struct gp_rank_spacket *) packet); break; case 6: - handleGProyal((struct gp_royal_spacket *) pkt); + handleGProyal ((struct gp_royal_spacket *) packet); break; case 7: - handleGPteamplanet((struct gp_teamplanet_spacket *) pkt); + handleGPteamplanet ((struct gp_teamplanet_spacket *) packet); break; default: - fprintf(stderr, "Gameparams packet subtype %d not yet implemented\n", - pkt->subtype); - }*/ + LineToConsole("Gameparams packet subtype %d not yet implemented\n", packet->subtype); + } } + #endif /* PARADISE*/ /* UDP stuff */ Index: data.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v retrieving revision 1.92 retrieving revision 1.93 diff -u -d -r1.92 -r1.93 --- data.c 16 May 2007 00:05:15 -0000 1.92 +++ data.c 17 May 2007 08:49:48 -0000 1.93 @@ -273,6 +273,29 @@ extern double Sin[], Cos[]; +#ifdef PARADISE +int paradise = 0; /* is the server a paradise server */ +int noParadiseBitmaps = 0; +int gwidth = GWIDTH; /* galaxy width, adjusted for zoom [BDyess] */ +int offsetx = 0; +int offsety = 0; /* offsets when zooming [BDyess] */ +int nplayers = 36; +int nshiptypes = 15; +int ntorps = 8; +int npthingies = 20; +int ngthingies = 0; +int nplasmas = 1; +int nphasers = 1; +int nplanets = MAXPLANETS; /* get this info dyn. from Pserver */ +struct teaminfo_s *teaminfo = NULL; +int number_of_teams = 4; +/* MOTD data */ +struct page *currpage = NULL; +struct page *pmotddata = NULL; +char blk_refitstring[80] = "s=scout, d=destroyer, c=cruiser, b=battleship, a=assault, o=starbase"; +int blk_friendlycloak = 0; /* Show color of cloakers who are friendly. */ +#endif + W_Icon fedteam, romteam, kliteam, oriteam; W_Icon stipple, clockpic, clockhandpic, genopic, genopic2, icon; @@ -317,6 +340,14 @@ W_Icon hull[BMP_HULL_FRAMES]; int vary_hull = 0; +// Paradise bitmaps +#ifdef PARADISE +W_Icon base_star_bitmap; +W_Icon star_bitmap[STAR_VIEWS]; +W_Icon star_mbitmap; +W_Icon paradise_ship_bitmaps; +W_Icon paradise_ships[NUM_PSHIP_TYPES][NUMTEAMS]; +#endif // Ships W_Icon ship_bitmaps[5]; W_Icon fed_bitmaps[NUM_TYPES][SHIP_VIEWS], kli_bitmaps[NUM_TYPES][SHIP_VIEWS], Index: feature.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/feature.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- feature.c 14 May 2007 02:56:40 -0000 1.18 +++ feature.c 17 May 2007 08:49:48 -0000 1.19 @@ -99,7 +99,11 @@ {"SHOW_CLOAKERS", &F_show_cloakers, 'S', 1, 0, 0}, {"TURN_KEYS", &F_turn_keys, 'S', 1, 0, 0}, {"SHOW_VISIBILITY_RANGE", &F_show_visibility_range, 'S', 1, 0, 0}, +#ifdef PARADISE + {"SP_FLAGS_ALL", &F_sp_flags_all, 'S', 0, 0, 0}, +#else {"SP_FLAGS_ALL", &F_sp_flags_all, 'S', 1, 0, 0}, +#endif {0, 0, 0, 0, 0, 0} }; @@ -285,6 +289,7 @@ } /* Ignore these feature packets for testing purposes */ #if DEBUG + motion_mouse_steering = 1; F_show_army_count = 1; F_show_other_speed = 1; F_show_cloakers = 1; Index: beeplite.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/beeplite.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- beeplite.c 28 Feb 2007 12:21:49 -0000 1.15 +++ beeplite.c 17 May 2007 08:49:48 -0000 1.16 @@ -62,8 +62,6 @@ emph_planet_seq_n[l->pl_no] = beep_lite_cycle_time_planet; l->pl_flags |= PLREDRAW; /* Leave redraw on until * * * done highlighting */ - l->pl_flags |= PLCLEAR; /* Leave redraw on until * * - * done highlighting */ } void liteplayer(struct player *j) Index: inform.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/inform.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- inform.c 14 Mar 2007 18:36:07 -0000 1.4 +++ inform.c 17 May 2007 08:49:48 -0000 1.5 @@ -32,9 +32,15 @@ * There is a different sized window for each type player/planet * and we take * care to keep it from extending beyond the main * window boundaries. */ +#ifdef PARADISE +static char *my_classes[NUM_TYPES] = { + "SC", "DD", "CA", "BB", "AS", "SB", "GA", "JS", "FL", "WB", "CL", "CV", "UT", "PT", "PU" +}; +#else static char *my_classes[NUM_TYPES] = { "SC", "DD", "CA", "BB", "AS", "SB", "GA", "AT" }; +#endif /******************************************************************************/ /*** inform() ***/ Index: map.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/map.c,v retrieving revision 1.55 retrieving revision 1.56 diff -u -d -r1.55 -r1.56 --- map.c 14 May 2007 02:56:41 -0000 1.55 +++ map.c 17 May 2007 08:49:49 -0000 1.56 @@ -38,6 +38,13 @@ #define DETAIL 100 #define SIZE (GWIDTH/DETAIL) +#ifdef PARADISE +int drawgrid = 1; /* goes to netrekrc eventually */ +int blk_zoom = 0; /* goes to netrekrc eventually */ +int sectorNums = 1; /* goes to netrekrc eventually */ +#define DRAWGRID 4 +#endif + /* * Local Variables: @@ -577,12 +584,24 @@ dy - (BMP_MPLANET_HEIGHT / 2 + 4), BMP_MPLANET_WIDTH + 8, BMP_MPLANET_HEIGHT + 8); - l->pl_flags &= ~PLCLEAR; } /* Draw the new planet */ - +#ifdef PARADISE + if (PL_TYPE(*l) == PLSTAR) + W_WriteScaleBitmap (dx - (BMP_MSTAR_WIDTH / 2) * SCALE / scaleFactor, + dy - (BMP_MSTAR_HEIGHT / 2) * SCALE / scaleFactor, + BMP_MSTAR_WIDTH * SCALE / scaleFactor, + BMP_MSTAR_HEIGHT * SCALE / scaleFactor, + BMP_MSTAR_WIDTH, + BMP_MSTAR_HEIGHT, + 0, + star_mbitmap, + planetColor (l), + mapw); + else +#endif #ifdef BEEPLITE if (useLite && emph_planet_seq_n[l->pl_no] > 0) { @@ -626,8 +645,6 @@ emph_planet_seq_n[l->pl_no] -= 1; l->pl_flags |= PLREDRAW; /* Leave redraw on until * * * done highlighting */ - l->pl_flags |= PLCLEAR; /* Leave redraw on until * * - * done highlighting */ } else { @@ -691,7 +708,13 @@ l->pl_name, 3, planetFont (l)); } - if (F_show_army_count && (showArmy == 2 || showArmy == 3) && (l->pl_info & me->p_team)) + if (F_show_army_count + && (showArmy == 2 || showArmy == 3) + && (l->pl_info & me->p_team) +#ifdef PARADISE + && (PL_TYPE(*l) != PLSTAR) +#endif + ) { char armbuf[4]; int armbuflen; @@ -855,6 +878,11 @@ int viewdist; int view = TWINSIDE * scaleFactor / 2; int mvx, mvy; +#ifdef PARADISE + static int osx = 0, osy = 0; /* old square */ + static int scalex, scaley; + static int grid_fuse; +#endif if (doubleBuffering) W_Win2Mem (mapSDB); @@ -868,6 +896,10 @@ dx = (me->p_x) / (GWIDTH / GWINSIDE); dy = (me->p_y) / (GWIDTH / GWINSIDE); +#ifdef PARADISE + grid_fuse++; /* we only draw the grids every DRAWGRID interval */ +#endif + if (redrawall) { /* @@ -897,8 +929,6 @@ for (l = planets + MAXPLANETS - 1; l >= planets; --l) l->pl_flags |= PLREDRAW; - - redrawall = 0; } else { @@ -971,6 +1001,109 @@ } } +#ifdef PARADISE + /* draw grid on galactic */ + if ((redrawall || (grid_fuse % DRAWGRID) == 0) && (drawgrid)) { + int x, y, width, h, grid; + char numbuf[1]; + int blk_gwidth = GWIDTH; /* hack */ + grid = GRIDSIZE * GWINSIDE / GWIDTH; + for (i = 1; i <= 6 / (blk_zoom ? 2 : 1); i++) { + /* looks nasty but we only have to do it 3 times if blk_zoom */ + + /* horizontal line */ + x = 0; + y = i * grid; + width = GWINSIDE; + numbuf[0] = '0' + (char) i; + if (blk_zoom) { + /* we might have to clip */ + dy = i * GRIDSIZE + offsety; + if (dy >= 0 && dy <= blk_gwidth + 2 * GRIDSIZE) { + if (offsetx < 0) { + x = grid; + width = 2 * x; + } else if (offsetx + 3 * GRIDSIZE > blk_gwidth) { + width = 2 * grid; + } + W_MakeDashedLine(mapw, x, y, x + width, y, W_Grey); + } + if (sectorNums) { + numbuf[0] = '0' + (char) (i + offsety / GRIDSIZE); + if ((numbuf[0] == '0') || (numbuf[0] == '7')) + numbuf[0] = ' '; + if (i == 1) /* so numbers dont overwrite in 1st box */ + W_WriteText(mapw, x + 2, y - grid + 11, W_Grey, numbuf, 1, + W_RegularFont); + else + W_WriteText(mapw, x + 2, y - grid + 2, W_Grey, numbuf, 1, + W_RegularFont); + } + } else { + W_MakeDashedLine(mapw, x, y, x + width, y, W_Grey); + if (sectorNums) { + W_WriteText(mapw, x + 2, y - grid + 2, W_Grey, numbuf, 1, W_RegularFont); + } + } + /* vertical line */ + x = i * grid; + y = 0; + h = GWINSIDE; + + if (blk_zoom) { + /* we might have to clip */ + dx = i * GRIDSIZE + offsetx; + if (dx >= 0 && dx <= blk_gwidth + 2 * GRIDSIZE) { + if (offsety < 0) { + y = grid; + h = 2 * y; + } else if (offsety + 3 * GRIDSIZE > blk_gwidth) { + h = 2 * grid; + } + W_MakeDashedLine(mapw, x, y, x, y + h, W_Grey); + } + if (sectorNums) { + numbuf[0] = '0' + (char) (i + offsetx / GRIDSIZE); + if ((numbuf[0] == '0') || (numbuf[0] == '7')) + numbuf[0] = ' '; + if (i == 1) + W_WriteText(mapw, x - grid + 11, y + 2, W_Grey, numbuf, 1, + W_RegularFont); + else + W_WriteText(mapw, x - grid + 2, y + 2, W_Grey, numbuf, 1, + W_RegularFont); + } + } else { + W_MakeDashedLine(mapw, x, y, x, y + h, W_Grey); + if (sectorNums) { + W_WriteText(mapw, x - grid + 2, y + 2, W_Grey, numbuf, 1, + W_RegularFont); + } + } + } + + scalex = ((me->p_x - offsetx) / GRIDSIZE) * GRIDSIZE; + scaley = ((me->p_y - offsety) / GRIDSIZE) * GRIDSIZE; + if (!redrawall && ((osx != scalex) || (osy != scaley))) { + + /* clear old sector */ + x = osx * GWINSIDE / GWIDTH; + y = osy * GWINSIDE / GWIDTH; + width = h = grid; + + W_WriteRectangle (mapw, x + 2, y + 2, width - 4, h - 4, 0, backColor); + + osx = scalex; + osy = scaley; + } + /* draw our current sector */ + x = scalex * GWINSIDE / GWIDTH; + width = h = grid; + y = scaley * GWINSIDE / GWIDTH; + + W_WriteRectangle (mapw, x + 2, y + 2, width - 4, h - 4, 1, yColor); + } +#endif /* Draw Planets */ @@ -1211,10 +1344,19 @@ } else { +#ifdef PARADISE + /* Paradise servers changed the ship cap protocol for + phaser damage :( */ + tx = (int) (j->p_x + j->p_ship.s_phaserdamage + * Cos[ph->ph_dir]) * GWINSIDE / GWIDTH; + ty = (int) (j->p_y + j->p_ship.s_phaserdamage + * Sin[ph->ph_dir]) * GWINSIDE / GWIDTH; +#else tx = (int) (j->p_x + PHASEDIST * j->p_ship.s_phaserdamage / 100 * Cos[ph->ph_dir]) * GWINSIDE / GWIDTH; ty = (int) (j->p_y + PHASEDIST * j->p_ship.s_phaserdamage / 100 * Sin[ph->ph_dir]) * GWINSIDE / GWIDTH; +#endif } break; case PHHIT2: @@ -1445,6 +1587,8 @@ } } + redrawall = 0; + if (doubleBuffering) W_Mem2Win (mapSDB); } Index: defaults.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v retrieving revision 1.85 retrieving revision 1.86 diff -u -d -r1.85 -r1.86 --- defaults.c 14 May 2007 02:56:40 -0000 1.85 +++ defaults.c 17 May 2007 08:49:48 -0000 1.86 @@ -23,6 +23,26 @@ #define DEFAULTSHIP NUM_TYPES +#ifdef PARADISE +struct shipdef shipdefaults[NUM_TYPES + 1] = { + {"sc", NULL, NULL, NULL, NULL}, + {"dd", NULL, NULL, NULL, NULL}, + {"ca", NULL, NULL, NULL, NULL}, + {"bb", NULL, NULL, NULL, NULL}, + {"as", NULL, NULL, NULL, NULL}, + {"sb", NULL, NULL, NULL, NULL}, + {"ga", NULL, NULL, NULL, NULL}, + {"js", NULL, NULL, NULL, NULL}, + {"fl", NULL, NULL, NULL, NULL}, + {"wb", NULL, NULL, NULL, NULL}, + {"cl", NULL, NULL, NULL, NULL}, + {"cv", NULL, NULL, NULL, NULL}, + {"ut", NULL, NULL, NULL, NULL}, + {"pt", NULL, NULL, NULL, NULL}, + {"pu", NULL, NULL, NULL, NULL}, + {"default", NULL, NULL, NULL, NULL} +}; +#else struct shipdef shipdefaults[NUM_TYPES + 1] = { {"sc", NULL, NULL, NULL, NULL}, {"dd", NULL, NULL, NULL, NULL}, @@ -34,6 +54,7 @@ {"att", NULL, NULL, NULL, NULL}, {"default", NULL, NULL, NULL, NULL} }; +#endif int myshiptype = DEFAULTSHIP; struct shipdef *myshipdef = &shipdefaults[DEFAULTSHIP];