From 0e471c82cd834b3de71cae54f604dbc4712ff342 Mon Sep 17 00:00:00 2001 From: ghaushe Date: Sun, 12 Jan 2003 00:27:54 +0000 Subject: [PATCH] Added alternating-pixel font effect (used for lander text messages) - currently this is only enabled for PC, since the 3DO needs color changes - added new obbkgnd.21.png which is the correct background for pc lander txt Changed "CAPTAIN", "FUEL", and "CREW" fonts (SIS) to be correct for PC Set black background for flagstat.0.png to be true black git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@542 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/ChangeLog | 2 + sc2/TODO | 3 +- sc2/content/ipanims/obbkgnd.21.png | Bin 0 -> 192 bytes sc2/content/ipanims/obbkgnd.ani | 1 + sc2/content/lbm/flagstat.0.png | Bin 1562 -> 1590 bytes sc2/src/sc2code/libs/gfxlib.h | 6 +- sc2/src/sc2code/libs/graphics/font.c | 25 ++++--- .../sc2code/libs/graphics/sdl/3do_getbody.c | 64 ++++++++++++------ sc2/src/sc2code/planets/report.c | 28 ++++++-- sc2/src/sc2code/sis.c | 54 ++++++++++++++- 10 files changed, 141 insertions(+), 42 deletions(-) create mode 100644 sc2/content/ipanims/obbkgnd.21.png diff --git a/sc2/ChangeLog b/sc2/ChangeLog index 6336f7f81..54c559b6b 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,6 @@ Changes towards version 0.2: +- Added new font effect (PC-lander messages), and set colors for text -PBlue +- Use correct font for 'CAPTAIN', 'FUEL', and 'CREW' is status screen -PBlue - Changed PC cmd-line options: now -a font,menu,scan -PhracturedBlue - Added gradiated font support (for ship name), and PC-font option -PBlue - Minor fixes to PCMenu by fOSSiL, Nic, PhracturedBlue diff --git a/sc2/TODO b/sc2/TODO index df9682fef..cc22221c6 100644 --- a/sc2/TODO +++ b/sc2/TODO @@ -91,8 +91,7 @@ Implementation bugs (low priority): - PC Menu still has some issues - Still using 3DO menu hierarchy, so menu text isn't identical to PC -PC Font issues: - - Update 'CREW' and 'FUEL' fonts to be identical to PC - - Correct Lander text font color to be the same as PC + - Lander font isn't correct (for PC or 3DO) Stuff still to do (large): - add some way to configure your keys diff --git a/sc2/content/ipanims/obbkgnd.21.png b/sc2/content/ipanims/obbkgnd.21.png new file mode 100644 index 0000000000000000000000000000000000000000..a828e4d3814a5733f8e4f26fa2817f4b0b82a23d GIT binary patch literal 192 zcmeAS@N?(olHy`uVBq!ia0vp^tRT$61SFYwH*Nw_Iwh_VCC){ui6xo&c?uz!xv31n zi6sh#h6-MZc?w1b2F418W>zLfK%}5+U}j)2b(7+Epg#5zPhVH|%Z%J&IvjK3!p;GO zI14-?iy0WWg+Q3`(%rg0KtYytM_)$E)e-c5Ki+j2_hE&{2PDwCGabWUE_+&FD dMI}&lGH)BY{d7JYD@<);T3K0RSd%FiZdd literal 0 HcmV?d00001 diff --git a/sc2/content/ipanims/obbkgnd.ani b/sc2/content/ipanims/obbkgnd.ani index 862175aab..7bd31cab8 100755 --- a/sc2/content/ipanims/obbkgnd.ani +++ b/sc2/content/ipanims/obbkgnd.ani @@ -19,3 +19,4 @@ obbkgnd.17.png 0 57 11 10 obbkgnd.18.png 0 57 0 0 obbkgnd.19.png 0 57 9 6 obbkgnd.20.png 0 57 2 -15 +obbkgnd.21.png 0 57 0 0 diff --git a/sc2/content/lbm/flagstat.0.png b/sc2/content/lbm/flagstat.0.png index 41769aaf0abd7684a412abba3e5ecaf41568b7ff..3ca78214a5c6cbeedb726900eba6489801cfa7f3 100644 GIT binary patch delta 801 zcmV++1K#|a47LoABsB+gNliru(*X+?C?ix%0KEVJ010qNS#tmY3labT3lag+-G2N4 z000DMK}|sb0I`n?{9y%=FiQde0I_|$0)J41J6`|*0=Y>RC$F(vTJwLu>?i7v9#yRjf;WIMTs{uf5bV= z#NV9X9PkCN_C9*tul7IPRiwxl&U$P48YNP1Fqo_hu{-4DjQpp5j1JvVJ;%!$wSSmU zMBU?Sllnz5RlgYFi{6tPN`5*Al&pN>-Msm)G|AWHBw{~F4zrN}On;6MCBmQzx8TT$cT|_eC zjgP#JA4pC&5y)581nk$;EYt)DP2|4DvMJoqF(9=i+J^6XeuN9NAwRra^) z7_j77v&#;+GsI5=Cyx9!_u^WG)&3RKRBVL{bQlNC(}IlFZsms`vX<}_1R$c`TtuG#BusS!(aMru>Ah?bi$h+r}oy5CBJz& zfnGMQJlWvArxv&7$#)QWhmSn;Kiq$~o?e4^SQD9W4}uxL+hM{8TUtASV8(B^n6@a9 zFcSFNn(TG00000NkvXXu0mjf=b)vA delta 773 zcmV+g1N!{744Mp(Bn$&{LP=Bz2ngHZPvDVRO9BN5v8KBMe>39=MF0Q*0d!JMQ~zz` zH|qcZ0=Y>k)r_OA?}c~#!{R|e30qRJcpBuXrJQ{MQO29P`p4R8Dt8W!08 z(J&!>|J(`1_K$_;l5hMoz9`y%G4!8K`Jb!b^3PoOj(-dOGyMFlagsAndIndex) >> FTYPE_SHIFT; NewFrame = CaptureDrawable ( - CreateDrawable (type, (SIZE)width, (SIZE)height, 1)); + CreateDrawable (FrameType, (SIZE)width, (SIZE)height, 1)); tfbOrigImg = (TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs); OrigImg = tfbOrigImg->NormalImg; SDL_LockSurface (OrigImg); @@ -342,30 +341,51 @@ FRAMEPTR Build_Gradiated_Font (FRAMEPTR FramePtr, Uint32 from, Uint32 to) to_b = (to >> 8) & 0xFF; to_a = to & 0xFF; - clrstep_r = (to_r - from_r) / (height - 5); - clrstep_g = (to_g - from_g) / (height - 5); - clrstep_b = (to_b - from_b) / (height - 5); - clrstep_a = (to_a - from_a) / (height - 5); clear = SDL_MapRGBA (img->format, 0, 0, 0, 0); - for (y = 0; y < 2; y++) for (x = 0; x < width; x++) putpix (img, x, y, clear); width--; - for (; y < height - 1; y++) + if (type == GRADIENT_EFFECT) { - color = SDL_MapRGBA (img->format, from_r, from_g, from_b, from_a); - from_r += clrstep_r; - from_g += clrstep_g; - from_b += clrstep_b; - from_a += clrstep_a; - for (x = 0; x < width; x++) - if (getpix (OrigImg, x, y) == 1) - putpix (img, x, y, color); - else - putpix (img, x, y, clear); - putpix (img, x, y, clear); + int clrstep_r, clrstep_g, clrstep_b, clrstep_a; + clrstep_r = (to_r - from_r) / (height - 5); + clrstep_g = (to_g - from_g) / (height - 5); + clrstep_b = (to_b - from_b) / (height - 5); + clrstep_a = (to_a - from_a) / (height - 5); + for (; y < height - 1; y++) + { + color = SDL_MapRGBA (img->format, from_r, from_g, from_b, from_a); + from_r += clrstep_r; + from_g += clrstep_g; + from_b += clrstep_b; + from_a += clrstep_a; + for (x = 0; x < width; x++) + if (getpix (OrigImg, x, y) == 1) + putpix (img, x, y, color); + else + putpix (img, x, y, clear); + putpix (img, x, y, clear); + } + } + else if (type == ALTERNATE_EFFECT) + { + Uint32 color1, color2; + color1 = SDL_MapRGBA (img->format, from_r, from_g, from_b, from_a); + color2 = SDL_MapRGBA (img->format, to_r, to_g, to_b, to_a); + for (; y < height - 1; y++) + { + for (x = 0; x < width; x++) + if (getpix (OrigImg, x, y) == 1) + { + color = ((y & 0x01) ^ (x & 0x01)) ? color2 : color1; + putpix (img, x, y, color); + } + else + putpix (img, x, y, clear); + putpix (img, x, y, clear); + } } width++; diff --git a/sc2/src/sc2code/planets/report.c b/sc2/src/sc2code/planets/report.c index 5202e0c33..0de407972 100644 --- a/sc2/src/sc2code/planets/report.c +++ b/sc2/src/sc2code/planets/report.c @@ -19,6 +19,7 @@ #include #include "starcon.h" #include "lander.h" +#include "options.h" #define NUM_CELL_COLS 34 #define NUM_CELL_ROWS 11 @@ -33,7 +34,10 @@ ClearReportArea () STAMP s; PRIMITIVE prim_row[NUM_CELL_COLS]; - s.frame = SetAbsFrameIndex (SpaceJunkFrame, 18); + if (optPCfonts) + s.frame = SetAbsFrameIndex (SpaceJunkFrame, 21); + else + s.frame = SetAbsFrameIndex (SpaceJunkFrame, 18); GetFrameRect (s.frame, &r); s.origin.x = 1 + (r.extent.width >> 1); s.origin.y = 1; @@ -43,8 +47,13 @@ ClearReportArea () s.origin.x += r.extent.width + 1; SetPrimNextLink (&prim_row[i], i + 1); - SetPrimType (&prim_row[i], STAMPFILL_PRIM); - SetPrimColor (&prim_row[i], BUILD_COLOR (MAKE_RGB15 (0x00, 0x07, 0x00), 0x57)); + if (optPCfonts) + SetPrimType (&prim_row[i], STAMP_PRIM); + else + { + SetPrimType (&prim_row[i], STAMPFILL_PRIM); + SetPrimColor (&prim_row[i], BUILD_COLOR (MAKE_RGB15 (0x00, 0x07, 0x00), 0x57)); + } } SetPrimNextLink (&prim_row[i - 1], END_OF_LIST); @@ -225,7 +234,18 @@ DoDiscoveryReport (SOUND ReadOutSounds) FONT OldFont; OldFont = SetContextFont (pSolarSysState->SysInfo.PlanetInfo.LanderFont); - MakeReport (ReadOutSounds, + if (optPCfonts) + { + SetContextFontEffect (ALTERNATE_EFFECT, + BUILD_COLOR_RGBA (0x00, 0x00, 0xD6, 0xFF), + BUILD_COLOR_RGBA (0x00, 0x04, 0xFF, 0xFF)); + MakeReport (ReadOutSounds, + (UNICODE *)GetStringAddress (pSolarSysState->SysInfo.PlanetInfo.DiscoveryString), + GetStringLength (pSolarSysState->SysInfo.PlanetInfo.DiscoveryString)); + SetContextFontEffect (0, 0, 0); + } + else + MakeReport (ReadOutSounds, (UNICODE *)GetStringAddress (pSolarSysState->SysInfo.PlanetInfo.DiscoveryString), GetStringLength (pSolarSysState->SysInfo.PlanetInfo.DiscoveryString)); SetContextFont (OldFont); diff --git a/sc2/src/sc2code/sis.c b/sc2/src/sc2code/sis.c index 15e91836d..6dcf0423a 100644 --- a/sc2/src/sc2code/sis.c +++ b/sc2/src/sc2code/sis.c @@ -379,14 +379,14 @@ DrawFlagshipName (BOOLEAN InStatusArea) t.align = ALIGN_CENTER; t.CharCount = (COUNT)~0; if (optPCfonts) - SetContextGradientFont( + SetContextFontEffect (GRADIENT_EFFECT, BUILD_COLOR_RGBA (0xF7, 0x2C, 0x00, 0xFF), BUILD_COLOR_RGBA (0xF7, 0xBA, 0x00, 0xFF)); else SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x14, 0x0A, 0x00), 0x0C)); DrawText (&t); if (optPCfonts) - SetContextGradientFont(0, 0); + SetContextFontEffect (0, 0, 0); SetContextForeGroundColor (OldColor); SetContextFont (OldFont); @@ -508,6 +508,54 @@ GetGaugeRect (PRECT pRect, BOOLEAN IsCrewRect) pRect->corner.y = IsCrewRect ? 117 : 38; } +void DrawPC_SIS () +{ + TEXT t; + RECT r; + UNICODE buf[10]; + GetGaugeRect (&r, FALSE); + t.baseline.x = STATUS_WIDTH >> 1; + t.baseline.y = r.corner.y - 1; + t.align = ALIGN_CENTER; + t.pStr = buf; + t.CharCount = (COUNT)~0; + SetContextFont (TinyFont); + SetContextForeGroundColor (BLACK_COLOR); + + r.corner.y -= 6; + r.corner.x--; + r.extent.width += 2; + DrawFilledRectangle (&r); + + SetContextFontEffect (GRADIENT_EFFECT, + BUILD_COLOR_RGBA (0x00, 0x4D, 0x00, 0xFF), + BUILD_COLOR_RGBA (0x00, 0xAE, 0x00, 0xFF)); + wsprintf (buf, "FUEL"); + DrawText (&t); + + r.corner.y += 79; + t.baseline.y += 79; + DrawFilledRectangle (&r); + + SetContextFontEffect (GRADIENT_EFFECT, + BUILD_COLOR_RGBA (0x6B, 0x00, 0x00, 0xFF), + BUILD_COLOR_RGBA (0xF7, 0x00, 0x00, 0xFF)); + wsprintf (buf, "CREW"); + DrawText (&t); + SetContextFontEffect (0, 0, 0); + + r.corner.x = 2 + 1; + r.corner.y = 3; + r.extent.width = 58; + r.extent.height = 7; + SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01)); + DrawFilledRectangle (&r); + SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x02, 0x04, 0x1E), 0x38)); + t.baseline.y = r.corner.y + 6; + wsprintf (buf, "CAPTAIN"); + DrawText (&t); +} + void DeltaSISGauges (SIZE crew_delta, SIZE fuel_delta, int resunit_delta) { @@ -531,6 +579,8 @@ DeltaSISGauges (SIZE crew_delta, SIZE fuel_delta, int resunit_delta) s.origin.x = s.origin.y = 0; s.frame = flagship_status; DrawStamp (&s); + if (optPCfonts) + DrawPC_SIS(); s.origin.x = 1; s.origin.y = 0;