|
|
| version 1.2, 2003/10/18 10:00:29 | version 1.5, 2004/03/23 18:34:05 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | #include "compiler.h" |
| #include <ddraw.h> | #include <ddraw.h> |
| #ifndef __GNUC__ | |
| #include <winnls32.h> | #include <winnls32.h> |
| #endif | |
| #include "resource.h" | #include "resource.h" |
| #include "np2.h" | #include "np2.h" |
| #include "mousemng.h" | #include "mousemng.h" |
| Line 19 typedef struct { | Line 21 typedef struct { |
| LPDIRECTDRAWSURFACE backsurf; | LPDIRECTDRAWSURFACE backsurf; |
| LPDIRECTDRAWCLIPPER clipper; | LPDIRECTDRAWCLIPPER clipper; |
| LPDIRECTDRAWPALETTE palette; | LPDIRECTDRAWPALETTE palette; |
| BYTE scrnmode; | UINT8 enable; |
| UINT8 scrnmode; | |
| int width; | int width; |
| int height; | int height; |
| int extend; | int extend; |
| Line 28 typedef struct { | Line 31 typedef struct { |
| RECT rect; | RECT rect; |
| #if defined(SUPPORT_16BPP) | #if defined(SUPPORT_16BPP) |
| RGB32 pal16mask; | RGB32 pal16mask; |
| BYTE r16b; | UINT8 r16b; |
| BYTE l16r; | UINT8 l16r; |
| BYTE l16g; | UINT8 l16g; |
| UINT8 padding16; | |
| #endif | #endif |
| #if defined(SUPPORT_8BPP) | #if defined(SUPPORT_8BPP) |
| PALETTEENTRY pal[256]; | PALETTEENTRY pal[256]; |
| Line 285 void scrnmng_initialize(void) { | Line 289 void scrnmng_initialize(void) { |
| setwindowsize(640, 400); | setwindowsize(640, 400); |
| } | } |
| BOOL scrnmng_create(BYTE scrnmode) { | BOOL scrnmng_create(UINT8 scrnmode) { |
| DWORD winstyle; | DWORD winstyle; |
| DWORD winstyleex; | DWORD winstyleex; |
| Line 325 BOOL scrnmng_create(BYTE scrnmode) { | Line 329 BOOL scrnmng_create(BYTE scrnmode) { |
| ddraw.ddraw1->QueryInterface(IID_IDirectDraw2, (void **)&ddraw2); | ddraw.ddraw1->QueryInterface(IID_IDirectDraw2, (void **)&ddraw2); |
| ddraw.ddraw2 = ddraw2; | ddraw.ddraw2 = ddraw2; |
| #if defined(SUPPORT_PC9821) | |
| scrnmode |= SCRNMODE_HIGHCOLOR; | |
| #endif | |
| if (scrnmode & SCRNMODE_FULLSCREEN) { | if (scrnmode & SCRNMODE_FULLSCREEN) { |
| ddraw2->SetCooperativeLevel(hWndMain, | ddraw2->SetCooperativeLevel(hWndMain, |
| DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_ALLOWREBOOT); | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_ALLOWREBOOT); |
| if (!(scrnmode & SCRNMODE_HIGHCOLOR)) { | if (!(scrnmode & SCRNMODE_HIGHCOLOR)) { |
| #if defined(SUPPORT_8BPP) | #if defined(SUPPORT_8BPP) |
| bitcolor = 8; | bitcolor = 8; |
| #elif defined(SUPPORT_16BPP) | |
| bitcolor = 16; | |
| #elif defined(SUPPORT_32BPP) | |
| bitcolor = 32; | |
| #elif defined(SUPPORT_24BPP) | |
| bitcolor = 24; | |
| #else | #else |
| goto scre_err; | goto scre_err; |
| #endif | #endif |
| Line 445 BOOL scrnmng_create(BYTE scrnmode) { | Line 458 BOOL scrnmng_create(BYTE scrnmode) { |
| } | } |
| scrnmng.bpp = (BYTE)bitcolor; | scrnmng.bpp = (BYTE)bitcolor; |
| scrnsurf.bpp = bitcolor; | scrnsurf.bpp = bitcolor; |
| ddraw.enable = TRUE; | |
| ddraw.scrnmode = scrnmode; | ddraw.scrnmode = scrnmode; |
| ddraw.width = 640; | ddraw.width = 640; |
| ddraw.height = 480; | ddraw.height = 480; |
| Line 503 UINT16 scrnmng_makepal16(RGB32 pal32) { | Line 517 UINT16 scrnmng_makepal16(RGB32 pal32) { |
| void scrnmng_topwinui(void) { | void scrnmng_topwinui(void) { |
| mouse_running(MOUSE_STOP); | mousemng_disable(MOUSEPROC_WINUI); |
| if (!ddraw.cliping++) { // ver0.28 | if (!ddraw.cliping++) { // ver0.28 |
| if (scrnmng.flag & SCRNFLAG_FULLSCREEN) { | if (scrnmng.flag & SCRNFLAG_FULLSCREEN) { |
| ddraw.primsurf->SetClipper(ddraw.clipper); | ddraw.primsurf->SetClipper(ddraw.clipper); |
| } | } |
| #ifndef __GNUC__ | |
| WINNLSEnableIME(hWndMain, TRUE); | WINNLSEnableIME(hWndMain, TRUE); |
| #endif | |
| } | } |
| } | } |
| void scrnmng_clearwinui(void) { | void scrnmng_clearwinui(void) { |
| if ((ddraw.cliping > 0) && (!(--ddraw.cliping))) { | if ((ddraw.cliping > 0) && (!(--ddraw.cliping))) { |
| #ifndef __GNUC__ | |
| WINNLSEnableIME(hWndMain, FALSE); | WINNLSEnableIME(hWndMain, FALSE); |
| #endif | |
| if (scrnmng.flag & SCRNFLAG_FULLSCREEN) { | if (scrnmng.flag & SCRNFLAG_FULLSCREEN) { |
| ddraw.primsurf->SetClipper(0); | ddraw.primsurf->SetClipper(0); |
| } | } |
| Line 523 void scrnmng_clearwinui(void) { | Line 541 void scrnmng_clearwinui(void) { |
| if (scrnmng.flag & SCRNFLAG_FULLSCREEN) { | if (scrnmng.flag & SCRNFLAG_FULLSCREEN) { |
| clearoutfullscreen(); | clearoutfullscreen(); |
| } | } |
| mouse_running(MOUSE_CONT); | mousemng_enable(MOUSEPROC_WINUI); |
| } | } |
| void scrnmng_setwidth(int posx, int width) { | void scrnmng_setwidth(int posx, int width) { |
| Line 622 void scrnmng_update(void) { | Line 640 void scrnmng_update(void) { |
| } | } |
| } | } |
| void scrnmng_restoresize(void) { | |
| if ((ddraw.enable) && (!(ddraw.scrnmode & SCRNMODE_FULLSCREEN))) { | |
| renewalclientsize(); | |
| } | |
| } | |