mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-16 03:06:45 -04:00
github publish
This commit is contained in:
commit
506e23bf32
542 changed files with 120675 additions and 0 deletions
684
Windows/BGraph2Dx.cpp
Normal file
684
Windows/BGraph2Dx.cpp
Normal file
|
@ -0,0 +1,684 @@
|
|||
#include <windows.h>
|
||||
#define DWORD_PTR DWORD *
|
||||
#include <d3d9.h>
|
||||
#include <debug.h>
|
||||
#include "Skeldal_win.h"
|
||||
#include "resource.h"
|
||||
|
||||
#define SKELDALCLASSNAME "BranySkeldalDXWindow"
|
||||
|
||||
#define INWINDOW runinwindow
|
||||
|
||||
static int dxWindowZoom=1;
|
||||
|
||||
static HWND hMainWnd;
|
||||
static IDirect3D9 *DxHandle;
|
||||
static IDirect3DDevice9 *DxDevice;
|
||||
static IDirect3DSurface9 *DxBackBuffer;
|
||||
static D3DPRESENT_PARAMETERS pparm;
|
||||
|
||||
static int initSizeX = 640;
|
||||
static int initSizeY = 480;
|
||||
|
||||
static unsigned short *mainBuffer=NULL;
|
||||
static unsigned short *secondBuffer=NULL;
|
||||
static unsigned short *curBuffer=NULL;
|
||||
static unsigned long main_linelen;
|
||||
|
||||
#ifdef _DX_REF
|
||||
#define DXDEVICE_TYPE D3DDEVTYPE_REF
|
||||
#else
|
||||
#define DXDEVICE_TYPE D3DDEVTYPE_HAL
|
||||
#endif
|
||||
|
||||
static bool dialogs=false;
|
||||
static bool runinwindow=false;
|
||||
static int shiftscrx=0,shiftscry=0;
|
||||
|
||||
void DXMouseTransform(unsigned short *x, unsigned short *y)
|
||||
{
|
||||
*x=*x*2/dxWindowZoom;
|
||||
*y=*y*2/dxWindowZoom;
|
||||
}
|
||||
|
||||
static const char *GetDXResult(HRESULT res)
|
||||
{
|
||||
const char *text;
|
||||
switch (res)
|
||||
{
|
||||
case D3DOK_NOAUTOGEN:text="D3DOK_NOAUTOGEN\r\n\r\nThis is a success code. However, the autogeneration of mipmaps is not supported for this format. This means that resource creation will succeed but the mipmap levels will not be automatically generated.";break;
|
||||
case D3DERR_CONFLICTINGRENDERSTATE:text="D3DERR_CONFLICTINGRENDERSTATE\r\n\r\nThe currently set render states cannot be used together.";break;
|
||||
case D3DERR_CONFLICTINGTEXTUREFILTER:text="D3DERR_CONFLICTINGTEXTUREFILTER\r\n\r\nThe current texture filters cannot be used together.";break;
|
||||
case D3DERR_CONFLICTINGTEXTUREPALETTE:text="D3DERR_CONFLICTINGTEXTUREPALETTE\r\n\r\nThe current textures cannot be used simultaneously.";break;
|
||||
case D3DERR_DEVICELOST:text="D3DERR_DEVICELOST\r\n\r\nThe device has been lost but cannot be reset at this time. Therefore, rendering is not possible.";break;
|
||||
case D3DERR_DEVICENOTRESET:text="D3DERR_DEVICENOTRESET\r\n\r\nThe device has been lost but can be reset at this time.";break;
|
||||
case D3DERR_DRIVERINTERNALERROR:text="D3DERR_DRIVERINTERNALERROR\r\n\r\nInternal driver error. Applications should destroy and recreate the device when receiving this error. For hints on debugging this error, see Driver Internal Errors.";break;
|
||||
case D3DERR_DRIVERINVALIDCALL:text="D3DERR_DRIVERINVALIDCALL\r\n\r\nNot used.";break;
|
||||
case D3DERR_INVALIDCALL:text="D3DERR_INVALIDCALL\r\n\r\nThe method call is invalid. For example, a method's parameter may not be a valid pointer.";break;
|
||||
case D3DERR_INVALIDDEVICE:text="D3DERR_INVALIDDEVICE\r\n\r\nThe requested device type is not valid.";break;
|
||||
case D3DERR_MOREDATA:text="D3DERR_MOREDATA\r\n\r\nThere is more data available than the specified buffer size can hold.";break;
|
||||
case D3DERR_NOTAVAILABLE:text="D3DERR_NOTAVAILABLE\r\n\r\nZarizeni neni podporovano. Tato chyba vetsinou vznika pri problemu graficke karty a ovladacu. Prosim preinstalujte ovladace ke graficke karte. (\"This device does not support the queried technique.\")";break;
|
||||
case D3DERR_NOTFOUND:text="D3DERR_NOTFOUND\r\n\r\nThe requested item was not found.";break;
|
||||
case D3DERR_OUTOFVIDEOMEMORY:text="D3DERR_OUTOFVIDEOMEMORY\r\n\r\nDirect3D does not have enough display memory to perform the operation.";break;
|
||||
case D3DERR_TOOMANYOPERATIONS:text="D3DERR_TOOMANYOPERATIONS\r\n\r\nThe application is requesting more texture-filtering operations than the device supports.";break;
|
||||
case D3DERR_UNSUPPORTEDALPHAARG:text="D3DERR_UNSUPPORTEDALPHAARG\r\n\r\nThe device does not support a specified texture-blending argument for the alpha channel.";break;
|
||||
case D3DERR_UNSUPPORTEDALPHAOPERATION:text="D3DERR_UNSUPPORTEDALPHAOPERATION\r\n\r\nThe device does not support a specified texture-blending operation for the alpha channel.";break;
|
||||
case D3DERR_UNSUPPORTEDCOLORARG:text="D3DERR_UNSUPPORTEDCOLORARG\r\n\r\nThe device does not support a specified texture-blending argument for color values.";break;
|
||||
case D3DERR_UNSUPPORTEDCOLOROPERATION:text="D3DERR_UNSUPPORTEDCOLOROPERATION\r\n\r\nThe device does not support a specified texture-blending operation for color values.";break;
|
||||
case D3DERR_UNSUPPORTEDFACTORVALUE:text="D3DERR_UNSUPPORTEDFACTORVALUE\r\n\r\nThe device does not support the specified texture factor value. Not used; provided only to support older drivers.";break;
|
||||
case D3DERR_UNSUPPORTEDTEXTUREFILTER:text="D3DERR_UNSUPPORTEDTEXTUREFILTER\r\n\r\nThe device does not support the specified texture filter.";break;
|
||||
case D3DERR_WASSTILLDRAWING:text="D3DERR_WASSTILLDRAWING\r\n\r\nThe previous blit operation that is transferring information to or from this surface is incomplete.";break;
|
||||
case D3DERR_WRONGTEXTUREFORMAT:text="D3DERR_WRONGTEXTUREFORMAT\r\n\r\nThe pixel format of the texture surface is not valid.";break;
|
||||
case E_FAIL:text="E_FAIL\r\n\r\nAn undetermined error occurred inside the Direct3D subsystem.";break;
|
||||
case E_INVALIDARG:text="E_INVALIDARG\r\n\r\nAn invalid parameter was passed to the returning function.";break;
|
||||
// case E_INVALIDCALL:text="E_INVALIDCALL\r\n\r\nThe method call is invalid. For example, a method's parameter may have an invalid value.";break;
|
||||
case E_NOINTERFACE:text="E_NOINTERFACE\r\n\r\nNo object interface is available.";break;
|
||||
case E_NOTIMPL:text="E_NOTIMPL\r\n\r\nNot implemented.";break;
|
||||
case E_OUTOFMEMORY:text="E_OUTOFMEMORY\r\n\r\nDirect3D could not allocate sufficient memory to complete the call.";break;
|
||||
default: text="Neznama chyba DX";break;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
static inline void CheckResult(HRESULT res)
|
||||
{
|
||||
if (res==0) return;
|
||||
char buff[512];
|
||||
sprintf(buff,"Chyba pri praci s DirectX: %s\r\nDxResult failed %8X (%d)",GetDXResult(res),res,res&0xFFFF);
|
||||
MessageBox(NULL,buff,NULL,MB_OK);
|
||||
ExitProcess(res);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
void setvesa_displaystart(int x,int y)
|
||||
{
|
||||
WINDOWPLACEMENT wp;
|
||||
wp.length=sizeof(wp);
|
||||
GetWindowPlacement(hMainWnd,&wp);
|
||||
wp.ptMaxPosition.x+=x-shiftscrx;
|
||||
wp.ptMaxPosition.y+=y-shiftscry;
|
||||
wp.rcNormalPosition.left+=x-shiftscrx;
|
||||
wp.rcNormalPosition.top+=y-shiftscry;
|
||||
wp.rcNormalPosition.right+=x-shiftscrx;
|
||||
wp.rcNormalPosition.bottom+=y-shiftscry;
|
||||
shiftscrx=x;
|
||||
shiftscry=y;
|
||||
SetWindowPlacement(hMainWnd,&wp);
|
||||
}
|
||||
|
||||
|
||||
#ifndef WINDOWCLASSFLAGS
|
||||
#define WINDOWCLASSFLAGS 0
|
||||
#endif
|
||||
|
||||
static void RegisterWindowClass()
|
||||
{
|
||||
WNDCLASSEX cls;
|
||||
cls.cbSize=sizeof(cls);
|
||||
cls.style=CS_HREDRAW|CS_VREDRAW|CS_OWNDC|WINDOWCLASSFLAGS ;
|
||||
cls.lpfnWndProc=(WNDPROC)GameMainWindowWindowProc;
|
||||
cls.cbClsExtra=0;
|
||||
cls.cbWndExtra=0;
|
||||
cls.hInstance=GetModuleHandle(NULL);
|
||||
cls.hIcon=LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_MAINICON));;
|
||||
cls.hCursor=NULL;
|
||||
cls.hbrBackground=NULL;
|
||||
cls.lpszMenuName=NULL;
|
||||
cls.lpszClassName=SKELDALCLASSNAME;
|
||||
cls.hIconSm=NULL;
|
||||
if (RegisterClassEx(&cls)==NULL)
|
||||
{
|
||||
MessageBox(NULL,"RegisterClassFailed",NULL,MB_OK);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
static void ColCalc()
|
||||
{
|
||||
do
|
||||
{
|
||||
long val;
|
||||
printf("number:");
|
||||
scanf("%X",&val);
|
||||
printf("RGB555(%d,%d,%d)\n",(val>>10),(val>>5) & 0x1F, val & 0x1F);
|
||||
}
|
||||
while (1);
|
||||
}
|
||||
|
||||
static void CreateSkeldalWindow()
|
||||
{
|
||||
//ColCalc();
|
||||
char buff[256];
|
||||
|
||||
LoadString(GetModuleHandle(NULL),IDS_WINTITLE,buff,sizeof(buff));
|
||||
|
||||
|
||||
RECT rc={0,0,initSizeX*dxWindowZoom/2,initSizeY*dxWindowZoom/2};
|
||||
DWORD flags=(INWINDOW?(WS_OVERLAPPED|WS_SYSMENU|WS_MINIMIZEBOX|WS_CAPTION|WS_BORDER):(WS_POPUP|WS_SYSMENU))|WS_VISIBLE;
|
||||
AdjustWindowRect(&rc,flags,FALSE);
|
||||
hMainWnd=CreateWindow(SKELDALCLASSNAME,buff,flags,100,100,rc.right-rc.left,rc.bottom-rc.top,NULL,NULL,GetModuleHandle(NULL),NULL);
|
||||
if (hMainWnd==NULL)
|
||||
{
|
||||
MessageBox(NULL,"WindowCreationFailed",NULL,MB_OK);
|
||||
exit(0);
|
||||
}
|
||||
UpdateWindow(hMainWnd);
|
||||
}
|
||||
|
||||
|
||||
static void DisplayMode(char init)
|
||||
{
|
||||
DEVMODE mode;
|
||||
int res;
|
||||
|
||||
if (init)
|
||||
{
|
||||
EnumDisplaySettings(NULL,ENUM_REGISTRY_SETTINGS,&mode);
|
||||
|
||||
mode.dmSize=sizeof(mode);
|
||||
mode.dmBitsPerPel=16;
|
||||
mode.dmFields=DM_BITSPERPEL|DM_DISPLAYFREQUENCY|DM_DISPLAYFLAGS|DM_PELSWIDTH|DM_PELSHEIGHT;
|
||||
|
||||
res=ChangeDisplaySettings(&mode,0);
|
||||
}
|
||||
else
|
||||
res=ChangeDisplaySettings(NULL,0);
|
||||
}
|
||||
|
||||
static bool ShowLogo()
|
||||
{
|
||||
HBITMAP logo=(HBITMAP)LoadImage(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_INITLOGO),IMAGE_BITMAP,0,0,0);
|
||||
if (logo==NULL) return false;
|
||||
HDC hDC;
|
||||
CheckResult(DxBackBuffer->GetDC(&hDC));
|
||||
HDC hBitmap=CreateCompatibleDC(hDC);
|
||||
HBITMAP old=(HBITMAP)SelectObject(hBitmap,logo);
|
||||
BitBlt(hDC,0,0,initSizeX,initSizeY,hBitmap,0,0,SRCCOPY);
|
||||
SelectObject(hBitmap,old);
|
||||
DeleteDC(hBitmap);
|
||||
DxBackBuffer->ReleaseDC(hDC);
|
||||
DeleteObject(logo);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CheckMessageQueue();
|
||||
|
||||
char DXInit64(char inwindow, int zoom, int monitor, int refresh)
|
||||
{
|
||||
runinwindow=inwindow!=0;
|
||||
dxWindowZoom=inwindow?zoom+1:2;
|
||||
|
||||
RegisterWindowClass();
|
||||
CreateSkeldalWindow();
|
||||
|
||||
DxHandle=Direct3DCreate9(D3D_SDK_VERSION);
|
||||
if (DxHandle==NULL)
|
||||
{
|
||||
MessageBox(hMainWnd,"Nepodarilo se inicializovat DirectX. "
|
||||
"Preinstalujte prosim DirectX ze stranek www.microsoft.com/directx. "
|
||||
"Ke spusteni je potreba mit aspon verzi DirectX 9.0c",NULL,MB_OK|MB_ICONEXCLAMATION);
|
||||
return 0;
|
||||
}
|
||||
|
||||
HMONITOR mon=DxHandle->GetAdapterMonitor(monitor);
|
||||
if (mon!=NULL)
|
||||
{
|
||||
MONITORINFO moninfo;
|
||||
moninfo.cbSize=sizeof(moninfo);
|
||||
GetMonitorInfo(mon,&moninfo);
|
||||
SetWindowPos(hMainWnd,NULL,moninfo.rcWork.left,moninfo.rcWork.top,0,0,SWP_NOZORDER|SWP_NOSIZE);
|
||||
}
|
||||
|
||||
pparm.BackBufferWidth=initSizeX;
|
||||
pparm. BackBufferHeight=initSizeY;
|
||||
pparm.BackBufferFormat=D3DFMT_R5G6B5;
|
||||
pparm.BackBufferCount=1;
|
||||
pparm.MultiSampleType=D3DMULTISAMPLE_NONE;
|
||||
pparm.SwapEffect=D3DSWAPEFFECT_COPY;
|
||||
pparm.hDeviceWindow=hMainWnd;
|
||||
pparm.Windowed=INWINDOW;
|
||||
pparm.EnableAutoDepthStencil=FALSE;
|
||||
pparm.Flags=D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
|
||||
pparm.FullScreen_RefreshRateInHz=INWINDOW?0:refresh;
|
||||
pparm.PresentationInterval=D3DPRESENT_INTERVAL_IMMEDIATE ;
|
||||
pparm.MultiSampleQuality=0;
|
||||
|
||||
HRESULT res;
|
||||
|
||||
res=DxHandle->CreateDevice(monitor,DXDEVICE_TYPE,hMainWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&pparm,&DxDevice);
|
||||
if (res!=0 && inwindow)
|
||||
{
|
||||
DisplayMode(1);
|
||||
res=DxHandle->CreateDevice(monitor,DXDEVICE_TYPE,hMainWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&pparm,&DxDevice);
|
||||
}
|
||||
if (res!=0)
|
||||
{
|
||||
res=DxHandle->CreateDevice(monitor,D3DDEVTYPE_REF,hMainWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&pparm,&DxDevice);
|
||||
}
|
||||
if (res!=0)
|
||||
{
|
||||
CheckResult(res);
|
||||
return 0;
|
||||
}
|
||||
|
||||
res=DxDevice->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO,&DxBackBuffer);
|
||||
CheckResult(res);
|
||||
|
||||
bool logo;
|
||||
logo=ShowLogo();
|
||||
|
||||
D3DLOCKED_RECT lrc;
|
||||
|
||||
res=DxBackBuffer->LockRect(&lrc,NULL,0);
|
||||
CheckResult(res);
|
||||
|
||||
main_linelen=dx_linelen=scr_linelen=lrc.Pitch;
|
||||
scr_linelen2=scr_linelen/2;
|
||||
curBuffer=mainBuffer=(unsigned short *)lrc.pBits;
|
||||
|
||||
secondBuffer=(unsigned short *)malloc(lrc.Pitch*initSizeY);
|
||||
|
||||
if (logo)
|
||||
{
|
||||
InvalidateRect(hMainWnd,NULL,TRUE);
|
||||
DWORD tm=GetTickCount()+5000;
|
||||
while (tm>GetTickCount()) {Sleep(100);CheckMessageQueue();}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void DXCloseMode()
|
||||
{
|
||||
if (DxDevice)
|
||||
{
|
||||
if (DxBackBuffer) DxBackBuffer->Release();
|
||||
DxDevice->Release();
|
||||
DxHandle->Release();
|
||||
DestroyWindow(hMainWnd);
|
||||
UnregisterClass(SKELDALCLASSNAME,GetModuleHandle(NULL));
|
||||
free(secondBuffer);
|
||||
if (runinwindow) DisplayMode(0);
|
||||
DxDevice=NULL;
|
||||
DxBackBuffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void HandleDeviceLost()
|
||||
{
|
||||
HRESULT res=D3DERR_DEVICELOST;
|
||||
DxBackBuffer->Release();
|
||||
DxBackBuffer=NULL;
|
||||
while (res==D3DERR_DEVICELOST)
|
||||
{
|
||||
while (DxDevice->TestCooperativeLevel()!=D3DERR_DEVICENOTRESET)
|
||||
{
|
||||
MSG msg;
|
||||
GetMessage(&msg,0,0,0);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
res=DxDevice->Reset(&pparm);
|
||||
}
|
||||
res=DxDevice->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO,&DxBackBuffer);
|
||||
CheckResult(res);
|
||||
res=DxDevice->Present(NULL,NULL,hMainWnd,NULL);
|
||||
}
|
||||
|
||||
static void GlobalPresent(RECT *prc)
|
||||
{
|
||||
RECT rc=*prc;
|
||||
RECT winrc=rc;
|
||||
int z=dxWindowZoom/2;
|
||||
if (dxWindowZoom!=2)
|
||||
{
|
||||
rc.left-=z;
|
||||
rc.top-=z;
|
||||
rc.right+=z;
|
||||
rc.bottom+=z;
|
||||
if (rc.left<0) rc.left=0;
|
||||
if (rc.top<0) rc.top=0;
|
||||
if (rc.right>=winrc.right) rc.right=winrc.right;
|
||||
if (rc.bottom>=winrc.bottom) rc.bottom=winrc.bottom;
|
||||
rc.left&=~1;
|
||||
rc.top&=~1;
|
||||
rc.right&=~1;
|
||||
rc.bottom&=~1;
|
||||
winrc=rc;
|
||||
winrc.left=winrc.left*dxWindowZoom/2;
|
||||
winrc.top=winrc.top*dxWindowZoom/2;
|
||||
winrc.right=winrc.right*dxWindowZoom/2;
|
||||
winrc.bottom=winrc.bottom*dxWindowZoom/2;
|
||||
}
|
||||
if (!dialogs)
|
||||
{
|
||||
LRESULT res=DxDevice->Present(&rc,&winrc,hMainWnd,NULL);
|
||||
if (res==D3DERR_DEVICELOST) HandleDeviceLost();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static bool UnLockBuffers()
|
||||
{
|
||||
if (DxBackBuffer==NULL) return false;
|
||||
HRESULT res;
|
||||
res=DxBackBuffer->UnlockRect();
|
||||
CheckResult(res);
|
||||
return true;
|
||||
}
|
||||
|
||||
static void LockBuffers()
|
||||
{
|
||||
D3DLOCKED_RECT lrc;
|
||||
HRESULT res;
|
||||
res=DxBackBuffer->LockRect(&lrc,NULL,0);
|
||||
CheckResult(res);
|
||||
|
||||
curBuffer=mainBuffer=(unsigned short *)lrc.pBits;
|
||||
if (dx_linelen!=lrc.Pitch)
|
||||
{
|
||||
free(secondBuffer);
|
||||
main_linelen=dx_linelen=scr_linelen=lrc.Pitch;
|
||||
scr_linelen2=scr_linelen/2;
|
||||
curBuffer=mainBuffer=(unsigned short *)lrc.pBits;
|
||||
secondBuffer=(unsigned short *)malloc(lrc.Pitch*initSizeY);
|
||||
}
|
||||
}
|
||||
|
||||
void DXCopyRects64(unsigned short x,unsigned short y,unsigned short xs,unsigned short ys)
|
||||
{
|
||||
if (UnLockBuffers()==false) return;
|
||||
|
||||
RECT rc;
|
||||
rc.left=x;
|
||||
rc.top=y;
|
||||
rc.right=x+xs;
|
||||
rc.bottom=y+ys;
|
||||
GlobalPresent(&rc);
|
||||
LockBuffers();
|
||||
|
||||
}
|
||||
|
||||
unsigned short *GetScreenAdr()
|
||||
{
|
||||
return curBuffer;
|
||||
}
|
||||
|
||||
unsigned short *GetBuffer2nd()
|
||||
{
|
||||
return secondBuffer;
|
||||
}
|
||||
|
||||
void RedirectScreen(unsigned short *newaddr)
|
||||
{
|
||||
curBuffer=newaddr;
|
||||
}
|
||||
|
||||
void RestoreScreen()
|
||||
{
|
||||
curBuffer=mainBuffer;
|
||||
scr_linelen=main_linelen;
|
||||
scr_linelen2=main_linelen>>1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void RedirectScreenBufferSecond()
|
||||
{
|
||||
curBuffer=secondBuffer;
|
||||
}
|
||||
|
||||
|
||||
void DXCopyRects64zoom2(unsigned short x,unsigned short y,unsigned short xs,unsigned short ys)
|
||||
{
|
||||
HRESULT res;
|
||||
if (UnLockBuffers()==false) return;
|
||||
|
||||
|
||||
RECT rc;
|
||||
rc.left=x;
|
||||
rc.top=y;
|
||||
rc.right=x+xs;
|
||||
rc.bottom=y+ys;
|
||||
RECT zoom;
|
||||
zoom.left=x;
|
||||
zoom.top=y;
|
||||
zoom.right=x+2*xs;
|
||||
zoom.bottom=y+2*ys;
|
||||
|
||||
res=DxDevice->Present(&rc,&zoom,hMainWnd,NULL);
|
||||
if (res==D3DERR_DEVICELOST) HandleDeviceLost();
|
||||
|
||||
|
||||
LockBuffers();
|
||||
}
|
||||
|
||||
|
||||
void *DxPrepareWalk(int ypos)
|
||||
{
|
||||
HRESULT res;
|
||||
|
||||
|
||||
IDirect3DSurface9 *tempbuff;
|
||||
res=DxDevice->CreateRenderTarget(640,360,D3DFMT_R5G6B5,D3DMULTISAMPLE_NONE,0,TRUE,&tempbuff,NULL);
|
||||
CheckResult(res);
|
||||
UnLockBuffers();
|
||||
RECT src;src.left=0;src.top=ypos;src.right=640;src.bottom=ypos+360;
|
||||
RECT trg;trg.left=0;trg.top=0;trg.right=640;trg.bottom=360;
|
||||
res=DxDevice->StretchRect(DxBackBuffer,&src,tempbuff,&trg,D3DTEXF_NONE);
|
||||
CheckResult(res);
|
||||
LockBuffers();
|
||||
|
||||
return (void *)tempbuff;
|
||||
}
|
||||
|
||||
void DxZoomWalk(void *handle, int ypos, int *points,float phase, void *lodka)
|
||||
{
|
||||
if (phase>1.0) phase=1.0f;
|
||||
if (phase<0.0) phase=0.0f;
|
||||
UnLockBuffers();
|
||||
IDirect3DSurface9 *surf=(IDirect3DSurface9 *)handle;
|
||||
RECT rc1;rc1.left=0;rc1.top=0;rc1.right=640;rc1.bottom=360;
|
||||
RECT rc2;rc2.left=points[0];rc2.top=points[1];rc2.right=points[2];rc2.bottom=points[3];
|
||||
RECT rcx;
|
||||
rcx.left=(int)(rc1.left+(rc2.left-rc1.left)*phase);
|
||||
rcx.top=(int)(rc1.top+(rc2.top-rc1.top)*phase);
|
||||
rcx.right=(int)(rc1.right+(rc2.right-rc1.right)*phase);
|
||||
rcx.bottom=(int)(rc1.bottom+(rc2.bottom-rc1.bottom)*phase);
|
||||
rc1.top+=ypos;
|
||||
rc1.bottom+=ypos;
|
||||
|
||||
/* HDC srcdc;
|
||||
HDC trgdc;
|
||||
HRESULT res;
|
||||
res=surf->GetDC(&srcdc);CheckResult(res);
|
||||
res=DxBackBuffer->GetDC(&trgdc);CheckResult(res);
|
||||
StretchBlt(
|
||||
trgdc,rc1.left,rc1.top,rc1.right-rc1.left,rc1.bottom-rc1.top,
|
||||
srcdc,rcx.left,rcx.top,rcx.right-rcx.left,rcx.bottom-rcx.top,SRCCOPY);
|
||||
surf->ReleaseDC(srcdc);
|
||||
DxBackBuffer->ReleaseDC(trgdc);
|
||||
*/
|
||||
|
||||
|
||||
HRESULT res;
|
||||
res=DxDevice->StretchRect(surf,&rcx,DxBackBuffer,&rc1,D3DTEXF_NONE);
|
||||
CheckResult(res);
|
||||
|
||||
GlobalPresent(&rc1);
|
||||
LockBuffers();
|
||||
}
|
||||
|
||||
void DxDoneWalk(void *handle)
|
||||
{
|
||||
IDirect3DSurface9 *surf=(IDirect3DSurface9 *)handle;
|
||||
if (surf) surf->Release();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DxTurnLeftRight(char right, float phase, int border, int ypos, int *last)
|
||||
{
|
||||
if (phase>1.0) phase=1.0f;
|
||||
if (phase<0.0) phase=0.0f;
|
||||
if (phase<0.05f) return;
|
||||
int space=640-2*border;
|
||||
|
||||
unsigned short *scr=GetScreenAdr()+scr_linelen2*ypos;
|
||||
unsigned short *buf=GetBuffer2nd()+scr_linelen2*ypos;
|
||||
|
||||
int turnout=(float)(space*phase)+border;
|
||||
int difto=turnout-*last;
|
||||
if (!right)
|
||||
{
|
||||
buf+=border;
|
||||
for (int y=0;y<360;y++)
|
||||
{
|
||||
memcpy(scr,scr+difto,(640-turnout)*2);
|
||||
memcpy(scr+(640-turnout),buf,(turnout)*2);
|
||||
scr+=scr_linelen2;
|
||||
buf+=scr_linelen2;
|
||||
}
|
||||
*last=turnout;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int y=0;y<360;y++)
|
||||
{
|
||||
memmove(scr+*last+difto-border,scr+*last-border,(640-turnout+border)*2);
|
||||
memcpy(scr,buf+(640-turnout)-border,turnout*2);
|
||||
scr+=scr_linelen2;
|
||||
buf+=scr_linelen2;
|
||||
}
|
||||
*last=turnout;
|
||||
}
|
||||
DXCopyRects64(0,ypos,640,360+ypos);
|
||||
}
|
||||
|
||||
void *DxPrepareTurn(int ypos)
|
||||
{
|
||||
IDirect3DSurface9 **handle=new IDirect3DSurface9 *[2];
|
||||
HRESULT res;
|
||||
|
||||
|
||||
res=DxDevice->CreateRenderTarget(640,360,D3DFMT_R5G6B5,D3DMULTISAMPLE_NONE,0,TRUE,handle,NULL);
|
||||
CheckResult(res);
|
||||
UnLockBuffers();
|
||||
RECT src;src.left=0;src.top=ypos;src.right=640;src.bottom=ypos+360;
|
||||
RECT trg;trg.left=0;trg.top=0;trg.right=640;trg.bottom=360;
|
||||
res=DxDevice->StretchRect(DxBackBuffer,&src,handle[0],&trg,D3DTEXF_NONE);
|
||||
CheckResult(res);
|
||||
|
||||
res=DxDevice->CreateRenderTarget(640,360,D3DFMT_R5G6B5,D3DMULTISAMPLE_NONE,0,TRUE,handle+1,NULL);
|
||||
CheckResult(res);
|
||||
D3DLOCKED_RECT lrect;
|
||||
res=handle[1]->LockRect(&lrect,NULL,0);
|
||||
CheckResult(res);
|
||||
|
||||
unsigned short *trgptr=(unsigned short *)lrect.pBits;
|
||||
unsigned short *srcptr=secondBuffer+scr_linelen2*ypos;
|
||||
for (int i=0;i<360;i++,trgptr=(unsigned short *)((char *)trgptr+lrect.Pitch),srcptr+=scr_linelen2)
|
||||
memcpy(trgptr,srcptr,640*2);
|
||||
handle[1]->UnlockRect();
|
||||
|
||||
LockBuffers();
|
||||
|
||||
return (void *)handle;
|
||||
}
|
||||
|
||||
|
||||
static inline void CopySurfaceAtPos(IDirect3DSurface9 *src, int width, int height, int xpos,int ypos, int border)
|
||||
{
|
||||
RECT trc;
|
||||
trc.left=xpos;
|
||||
trc.top=ypos;
|
||||
trc.right=xpos+width;
|
||||
trc.bottom=ypos+height;
|
||||
RECT s_rc;
|
||||
s_rc.left=0;
|
||||
s_rc.top=0;
|
||||
s_rc.right=width;
|
||||
s_rc.bottom=height;
|
||||
if (border<0)
|
||||
{
|
||||
trc.left-=border;
|
||||
s_rc.left-=border;
|
||||
}
|
||||
else
|
||||
{
|
||||
trc.right-=border;
|
||||
s_rc.right-=border;
|
||||
}
|
||||
if (trc.left<0) {s_rc.left-=trc.left*0.7;trc.left=0;}
|
||||
if (trc.right>=640) {s_rc.right-=(trc.right-640)*0.7;trc.right=640;}
|
||||
CheckResult(DxDevice->StretchRect(src,&s_rc,DxBackBuffer,&trc,D3DTEXF_NONE));
|
||||
}
|
||||
|
||||
void DxTurn(void *handle, char right, int ypos,int border, float phase, void *lodka)
|
||||
{
|
||||
right=!right;
|
||||
if (phase>1.0) phase=1.0f;
|
||||
if (phase<0.0) phase=0.0f;
|
||||
UnLockBuffers();
|
||||
IDirect3DSurface9 **ihandle=(IDirect3DSurface9 **)handle;
|
||||
IDirect3DSurface9 *sleft=ihandle[right?0:1];
|
||||
IDirect3DSurface9 *sright=ihandle[right?1:0];
|
||||
int width=640-border*2;
|
||||
int xpos=(int)border+width*phase;
|
||||
if (right) xpos=640-xpos;
|
||||
CopySurfaceAtPos(sleft,640,360,xpos-640+border,ypos,border);
|
||||
CopySurfaceAtPos(sright,640,360,xpos-border,ypos,-border);
|
||||
|
||||
|
||||
RECT rc={0,ypos,640,ypos+360};
|
||||
|
||||
GlobalPresent(&rc);
|
||||
LockBuffers();
|
||||
}
|
||||
|
||||
|
||||
void DxDoneTurn(void *handle)
|
||||
{
|
||||
IDirect3DSurface9 **ihandle=(IDirect3DSurface9 **)handle;
|
||||
ihandle[0]->Release();
|
||||
ihandle[1]->Release();
|
||||
delete [] ihandle;
|
||||
}
|
||||
|
||||
void DxDialogs(char enable)
|
||||
{
|
||||
dialogs=enable!=0;
|
||||
}
|
||||
|
||||
}
|
||||
HWND GetGameWindow()
|
||||
{return hMainWnd;}
|
||||
|
||||
void DxLockBuffers(BOOL lock)
|
||||
{
|
||||
if (lock) LockBuffers();
|
||||
else UnLockBuffers();
|
||||
}
|
||||
|
||||
void StripBlt(void *data, unsigned int startline, unsigned long width)
|
||||
{
|
||||
unsigned short *start=startline*scr_linelen2+GetScreenAdr();
|
||||
while (width--)
|
||||
{
|
||||
memcpy(start,data,640*2);
|
||||
data=(void *)((char *)data+scr_linelen);
|
||||
start=start+scr_linelen2;
|
||||
}
|
||||
}
|
||||
|
||||
void DxSetInitResolution(int x, int y)
|
||||
{
|
||||
initSizeX = x;
|
||||
initSizeY = y;
|
||||
|
||||
}
|
||||
|
||||
int DxGetResX() {return initSizeX;}
|
||||
int DxGetResY() {return initSizeY;}
|
58
Windows/BGraph2Dx.h
Normal file
58
Windows/BGraph2Dx.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
#ifndef __BGRAPH_DX_WRAPPER_
|
||||
#define __BGRAPH_DX_WRAPPER_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern long scr_linelen;
|
||||
extern long scr_linelen2;
|
||||
extern long dx_linelen;
|
||||
|
||||
|
||||
//inicializuje a otevira rezim 640x480x16b v DX - otevre okno, pripravi vse pro beh hry
|
||||
//Vraci 1 pri uspechu
|
||||
char DXInit64(char inwindow,int zoom,int monitor, int refresh);
|
||||
|
||||
//uzavre rezim grafiky
|
||||
void DXCloseMode();
|
||||
|
||||
//void DXCopyRects32(unsigned short x,unsigned short y,unsigned short xs,unsigned short ys);
|
||||
void DXCopyRects64(unsigned short x,unsigned short y,unsigned short xs,unsigned short ys);
|
||||
void DXCopyRects64zoom2(unsigned short x,unsigned short y,unsigned short xs,unsigned short ys);
|
||||
|
||||
void *DxPrepareWalk(int ypos);
|
||||
void DxZoomWalk(void *handle, int ypos, int *points,float phase, void *lodka);
|
||||
void DxDoneWalk(void *handle);
|
||||
|
||||
void *DxPrepareTurn(int ypos);
|
||||
void DxTurn(void *handle, char right, int ypos,int border, float phase, void *lodka);
|
||||
void DxDoneTurn(void *handle);
|
||||
void DxTurnLeftRight(char right, float phase, int border, int ypos, int *last);
|
||||
|
||||
|
||||
void DxDialogs(char enable);
|
||||
|
||||
void setvesa_displaystart(int x,int y);
|
||||
|
||||
extern long scr_linelen;
|
||||
extern long scr_linelen2;
|
||||
|
||||
void DxSetInitResolution(int x, int y);
|
||||
int DxGetResX();
|
||||
int DxGetResY();
|
||||
|
||||
void DXMouseTransform(unsigned short *x, unsigned short *y);
|
||||
|
||||
HWND GetGameWindow();
|
||||
void DxLockBuffers(BOOL lock);
|
||||
|
||||
void StripBlt(void *data, unsigned int startline, unsigned long width);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
BIN
Windows/BOLDCZ.FON
Normal file
BIN
Windows/BOLDCZ.FON
Normal file
Binary file not shown.
209
Windows/FCS_Tasker.c
Normal file
209
Windows/FCS_Tasker.c
Normal file
|
@ -0,0 +1,209 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <memman.h>
|
||||
#include "types.h"
|
||||
#include "event.h"
|
||||
#include <debug.h>
|
||||
#include "FCS_Tasker.h"
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
#define MAX_FIBERS 32
|
||||
|
||||
typedef struct _fcs_taskerstruct
|
||||
{
|
||||
void *fiberHandle;
|
||||
int wait_event;
|
||||
char waiting:1;
|
||||
char exitFiber:1;
|
||||
char usedSlot:1;
|
||||
} FCS_TASKERSTRUCT;
|
||||
|
||||
#define THREADDECL __declspec (thread)
|
||||
|
||||
static THREADDECL FCS_TASKERSTRUCT fiberList[MAX_FIBERS];
|
||||
static THREADDECL int fiberNextSlot=-1;
|
||||
static THREADDECL void *mainFiber=NULL;
|
||||
static THREADDECL void *cleaningFiber=NULL;
|
||||
static THREADDECL int currentFiber=-1;
|
||||
static THREADDECL int lastTask=-1;
|
||||
static THREADDECL void *switchData=NULL;
|
||||
static THREADDECL int task_count=0;
|
||||
|
||||
static void CALLBACK CleaningFiber(void *lpParameter)
|
||||
{
|
||||
do
|
||||
{
|
||||
SEND_LOG("(TASKER) Cleaning task %d",currentFiber,0);
|
||||
assert(currentFiber>=0);
|
||||
DeleteFiber(fiberList[currentFiber].fiberHandle);
|
||||
fiberList[currentFiber].usedSlot=0;
|
||||
currentFiber=-1;
|
||||
switchData=NULL;
|
||||
task_count--;
|
||||
SwitchToFiber(mainFiber);
|
||||
}
|
||||
while (1);
|
||||
}
|
||||
|
||||
static void InitFibers()
|
||||
{
|
||||
mainFiber=ConvertThreadToFiber(NULL);
|
||||
cleaningFiber=CreateFiber(0,CleaningFiber,NULL);
|
||||
currentFiber=-1;
|
||||
fiberNextSlot=0;
|
||||
memset(fiberList,0,sizeof(fiberList));
|
||||
SEND_LOG("(TASKER) Fibers inicialized",0,0);
|
||||
}
|
||||
|
||||
static int GetFreeFiberSlot()
|
||||
{
|
||||
int save=fiberNextSlot;
|
||||
do
|
||||
{
|
||||
if (fiberNextSlot<0) fiberNextSlot+=MAX_FIBERS;
|
||||
if (fiberList[fiberNextSlot].usedSlot==0) return fiberNextSlot--;
|
||||
fiberNextSlot--;
|
||||
}
|
||||
while (fiberNextSlot!=save);
|
||||
STOP();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void CALLBACK RunUserFiber(void *params)
|
||||
{
|
||||
va_list p=(va_list)switchData;
|
||||
TaskerFunctionName fcname=(TaskerFunctionName)params;
|
||||
fcname(p);
|
||||
SwitchToFiber(cleaningFiber);
|
||||
}
|
||||
|
||||
int add_task(int stack,TaskerFunctionName fcname,...)
|
||||
{
|
||||
if (mainFiber==NULL) InitFibers();
|
||||
{
|
||||
int fib=GetFreeFiberSlot();
|
||||
va_list args;
|
||||
|
||||
fiberList[fib].usedSlot=1;
|
||||
fiberList[fib].waiting=0;
|
||||
fiberList[fib].exitFiber=0;
|
||||
fiberList[fib].fiberHandle=CreateFiber(0,RunUserFiber,fcname);
|
||||
va_start(args,fcname);
|
||||
switchData=args;
|
||||
currentFiber=fib;
|
||||
task_count++;
|
||||
SEND_LOG("(TASKER) Adding task %d",fib,0);
|
||||
SwitchToFiber(fiberList[fib].fiberHandle);
|
||||
return fib;
|
||||
}
|
||||
}
|
||||
|
||||
void term_task(int id_num)
|
||||
{
|
||||
fiberList[id_num].exitFiber=1;
|
||||
}
|
||||
|
||||
char is_running(int id_num)
|
||||
{
|
||||
return fiberList[id_num].usedSlot;
|
||||
}
|
||||
|
||||
void suspend_task(int id_num,int msg)
|
||||
{
|
||||
fiberList[id_num].waiting=1;
|
||||
fiberList[id_num].wait_event=msg;
|
||||
}
|
||||
|
||||
void shut_down_task(int id_num)
|
||||
{
|
||||
if (fiberList[id_num].usedSlot)
|
||||
{
|
||||
SEND_LOG("(TASKER) Killing task %d",id_num,0);
|
||||
DeleteFiber(fiberList[id_num].fiberHandle);
|
||||
task_count--;
|
||||
fiberList[id_num].usedSlot=0;
|
||||
}
|
||||
}
|
||||
|
||||
static void *FCSTaskSleep(void *data,int fiber)
|
||||
{
|
||||
if (mainFiber==NULL) return data;
|
||||
if (fiber==-1)
|
||||
{
|
||||
currentFiber=fiber;
|
||||
if (GetCurrentFiber()==mainFiber) return data;
|
||||
switchData=data;
|
||||
SwitchToFiber(mainFiber);
|
||||
return switchData;
|
||||
}
|
||||
if (fiberList[fiber].usedSlot)
|
||||
{
|
||||
currentFiber=fiber;
|
||||
if (GetCurrentFiber()==fiberList[fiber].fiberHandle) return data;
|
||||
switchData=data;
|
||||
SwitchToFiber(fiberList[fiber].fiberHandle);
|
||||
return switchData;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
void unsuspend_task(EVENT_MSG *msg)
|
||||
{
|
||||
int id_num;
|
||||
for (id_num=0;id_num<MAX_FIBERS;id_num++) if (fiberList[id_num].usedSlot && fiberList[id_num].waiting && fiberList[id_num].wait_event==msg->msg)
|
||||
{
|
||||
FCSTaskSleep(msg,id_num);
|
||||
}
|
||||
}
|
||||
|
||||
void *task_sleep(void *data)
|
||||
{
|
||||
int i,p=lastTask+1;
|
||||
if (currentFiber!=-1) return FCSTaskSleep(data,-1);
|
||||
for (i=0;i<MAX_FIBERS;i++,p++)
|
||||
{
|
||||
if (p>=MAX_FIBERS) p-=MAX_FIBERS;
|
||||
if (fiberList[p].usedSlot && !fiberList[p].waiting)
|
||||
{
|
||||
lastTask=p;
|
||||
return FCSTaskSleep(data,p);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
void *task_wait_event(long event_number)
|
||||
{
|
||||
void *p;
|
||||
suspend_task(currentFiber,event_number);
|
||||
p=task_sleep((void *)event_number);
|
||||
fiberList[currentFiber].waiting=0;
|
||||
if (p==NULL) return NULL;
|
||||
return ((EVENT_MSG *)p)->data;
|
||||
}
|
||||
|
||||
int q_any_task()
|
||||
{
|
||||
return task_count;
|
||||
}
|
||||
|
||||
char task_quitmsg()
|
||||
{
|
||||
return task_quitmsg_by_id(currentFiber);
|
||||
}
|
||||
|
||||
char task_quitmsg_by_id(int id)
|
||||
{
|
||||
return fiberList[id].exitFiber;
|
||||
}
|
||||
|
||||
char q_is_mastertask()
|
||||
{
|
||||
return currentFiber==-1;
|
||||
}
|
||||
|
||||
int q_current_task()
|
||||
{
|
||||
return currentFiber;
|
||||
}
|
32
Windows/FCS_Tasker.h
Normal file
32
Windows/FCS_Tasker.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
#ifndef _FCS_TASKER_H_
|
||||
#define _FCS_TASKER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
typedef void (*TaskerFunctionName)(va_list);
|
||||
|
||||
void tasker(EVENT_MSG *msg,void **data);
|
||||
int create_task();
|
||||
int add_task(int stack,TaskerFunctionName fcname,...);
|
||||
void term_task(int id_num);
|
||||
char is_running(int id_num);
|
||||
void suspend_task(int id_num,int msg);
|
||||
void shut_down_task(int id_num);
|
||||
void unsuspend_task(EVENT_MSG *msg);
|
||||
void *task_sleep(void *data);
|
||||
void *task_wait_event(long event_number);
|
||||
int q_any_task();
|
||||
char task_quitmsg();
|
||||
char task_quitmsg_by_id(int id);
|
||||
char q_is_mastertask();
|
||||
int q_current_task();
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
507
Windows/Music.cpp
Normal file
507
Windows/Music.cpp
Normal file
|
@ -0,0 +1,507 @@
|
|||
#include "skeldal_win.h"
|
||||
#include <malloc.h>
|
||||
#include <debug.h>
|
||||
#include <stdio.h>
|
||||
#define DWORD_PTR DWORD *
|
||||
#include <dsound.h>
|
||||
#include "types.h"
|
||||
#include "zvuk.h"
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
extern "C" {
|
||||
#include <memman.h>
|
||||
}
|
||||
#include "Music.h"
|
||||
|
||||
|
||||
#define BUFFER_SIZE (512*1024)
|
||||
#define LOCK_GRANUALITY 16384
|
||||
|
||||
MusicPlayer::MusicPlayer()
|
||||
{
|
||||
_ds8Buffer=0;
|
||||
_volume=255;
|
||||
InitializeCriticalSection(&_lock);
|
||||
}
|
||||
|
||||
MusicPlayer::~MusicPlayer()
|
||||
{
|
||||
Done();
|
||||
DeleteCriticalSection(&_lock);
|
||||
}
|
||||
|
||||
HRESULT MusicPlayer::InitBuffer(IDirectSound8 *ds8, int *linvoltable)
|
||||
{
|
||||
HRESULT hres;
|
||||
|
||||
WAVEFORMATEX wfex;
|
||||
wfex.cbSize=sizeof(wfex);
|
||||
wfex.wBitsPerSample=16;
|
||||
wfex.nBlockAlign=4;
|
||||
wfex.nSamplesPerSec=44100;
|
||||
wfex.nAvgBytesPerSec=wfex.nSamplesPerSec*wfex.nBlockAlign;
|
||||
wfex.wFormatTag=WAVE_FORMAT_PCM;
|
||||
wfex.nChannels=2;
|
||||
|
||||
DSBUFFERDESC desc;
|
||||
desc.dwSize=sizeof(desc);
|
||||
desc.dwBufferBytes=BUFFER_SIZE;
|
||||
desc.dwReserved=0;
|
||||
desc.dwFlags=DSBCAPS_CTRLVOLUME ;
|
||||
desc.lpwfxFormat=&wfex;
|
||||
|
||||
IDirectSoundBuffer *dsbf;
|
||||
|
||||
hres=ds8->CreateSoundBuffer(&desc,&dsbf,NULL);
|
||||
hres=dsbf->QueryInterface(IID_IDirectSoundBuffer8,(void **)&_ds8Buffer);
|
||||
dsbf->Release();
|
||||
|
||||
_linvoltable=linvoltable;
|
||||
return hres;
|
||||
}
|
||||
|
||||
HRESULT MusicPlayer::Play()
|
||||
{
|
||||
_lastWritePos=0;
|
||||
DWORD size;
|
||||
void *ptr;
|
||||
|
||||
_ds8Buffer->Lock(0,0,&ptr,&size,NULL,NULL,DSBLOCK_ENTIREBUFFER);
|
||||
memset(ptr,0,size);
|
||||
_ds8Buffer->Unlock(ptr,size,NULL,NULL);
|
||||
_ds8Buffer->SetVolume(_linvoltable[_volume]);
|
||||
HRESULT res=_ds8Buffer->Play(0,0,DSBPLAY_LOOPING);
|
||||
_crossfadebytes=0;
|
||||
_minorpos=0;
|
||||
return res;
|
||||
}
|
||||
|
||||
class AutoCloseCriticalSection
|
||||
{
|
||||
LPCRITICAL_SECTION lcrit;
|
||||
public:
|
||||
AutoCloseCriticalSection(LPCRITICAL_SECTION l):lcrit(l)
|
||||
{
|
||||
EnterCriticalSection(lcrit);
|
||||
}
|
||||
~AutoCloseCriticalSection()
|
||||
{
|
||||
LeaveCriticalSection(lcrit);
|
||||
}
|
||||
};
|
||||
|
||||
int MusicPlayer::Open(int samplerate, int numchannels, int bitspersamp, int bufferlenms, int prebufferms)
|
||||
{
|
||||
AutoCloseCriticalSection lsect(&_lock);
|
||||
if (numchannels<1 || numchannels>2) return -1;
|
||||
if (bitspersamp!=8 && bitspersamp!=16) return -1;
|
||||
_stereo=numchannels==2;
|
||||
_bit16=bitspersamp==16;
|
||||
_speed=samplerate*1024/44100;
|
||||
if (_speed<128) return -1;
|
||||
_opened=true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
HRESULT MusicPlayer::Done()
|
||||
{
|
||||
if (_ds8Buffer) _ds8Buffer->Release();
|
||||
_ds8Buffer=0;
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
DWORD MusicPlayer::GetSafeXFadePos()
|
||||
{
|
||||
DWORD curPos;
|
||||
_ds8Buffer->GetCurrentPosition(0,&curPos);
|
||||
int curpos=curPos;
|
||||
if (curpos>(int)_lastWritePos) curpos-=BUFFER_SIZE;
|
||||
curpos+=BUFFER_SIZE/4;
|
||||
if (curpos>(int)_lastWritePos) curpos=_lastWritePos;
|
||||
if (curpos<0) curpos+=BUFFER_SIZE;
|
||||
if (curpos>=BUFFER_SIZE) curpos-=BUFFER_SIZE;
|
||||
return curpos;
|
||||
}
|
||||
|
||||
static const float Inv2=0.5;
|
||||
static const float Snapper=3<<22;
|
||||
|
||||
static inline short toInt( float fval )
|
||||
{
|
||||
fval += Snapper;
|
||||
return (short)( (*(int *)&fval)&0x007fffff ) - 0x00400000;
|
||||
}
|
||||
|
||||
void MusicPlayer::Close()
|
||||
{
|
||||
if (TryEnterCriticalSection(&_lock)==FALSE)
|
||||
{
|
||||
DWORD status;
|
||||
_ds8Buffer->GetStatus(&status);
|
||||
_ds8Buffer->Play(0,0,DSBPLAY_LOOPING);
|
||||
EnterCriticalSection(&_lock);
|
||||
if ((status & DSBSTATUS_PLAYING)==0)
|
||||
_ds8Buffer->Stop();
|
||||
}
|
||||
|
||||
if (_crossfadebytes==0)
|
||||
{
|
||||
DWORD xfadepos=GetSafeXFadePos();
|
||||
DWORD xfadesz=xfadepos>_lastWritePos?(_lastWritePos+BUFFER_SIZE-xfadepos):(_lastWritePos-xfadepos);
|
||||
void *ptr[2];
|
||||
DWORD sz[2];
|
||||
float ffadesz=(float)xfadesz*0.5f;
|
||||
float ffadecnt=0;
|
||||
if (xfadesz && _ds8Buffer->Lock(xfadepos,xfadesz,ptr+0,sz+0,ptr+1,sz+1,0)==0)
|
||||
{
|
||||
for (int i=0;i<2;i++) if (ptr[i])
|
||||
{
|
||||
for (DWORD j=0;j<sz[i];j+=2)
|
||||
{
|
||||
short *sample=(short *)((char *)ptr[i]+j);
|
||||
sample[0]=toInt(sample[0]-sample[0]*ffadecnt/ffadesz);
|
||||
ffadecnt=ffadecnt+1.0f;
|
||||
if (ffadecnt>ffadesz) ffadecnt=ffadesz;
|
||||
}
|
||||
}
|
||||
_ds8Buffer->Unlock(ptr[0],sz[0],ptr[1],sz[1]);
|
||||
}
|
||||
_crossfadebytes=xfadesz;
|
||||
_lastWritePos=xfadepos;
|
||||
}
|
||||
_opened=false;
|
||||
LeaveCriticalSection(&_lock);
|
||||
}
|
||||
|
||||
int MusicPlayer::Write(const char *buf, int len)
|
||||
{
|
||||
EnterCriticalSection(&_lock);
|
||||
if (!_opened)
|
||||
{
|
||||
LeaveCriticalSection(&_lock);
|
||||
return 1;
|
||||
}
|
||||
DWORD step=(_stereo?2:1) * (_bit16?2:1);
|
||||
void *lockptr[2]={0,0};
|
||||
DWORD locksz[2]={0,0};
|
||||
void *wrtptr=0;
|
||||
DWORD remainspace=0;
|
||||
int stage=0;
|
||||
|
||||
while (len>0)
|
||||
{
|
||||
short sample[2];
|
||||
|
||||
if (_bit16)
|
||||
if (_stereo)
|
||||
{
|
||||
sample[0]=*((short *)buf);
|
||||
sample[1]=*((short *)buf+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
sample[0]=*((short *)buf);
|
||||
sample[1]=*((short *)buf);
|
||||
}
|
||||
else
|
||||
if (_stereo)
|
||||
{
|
||||
sample[0]=(*buf)*256;
|
||||
sample[1]=(*(buf+1))*256;
|
||||
}
|
||||
else
|
||||
{
|
||||
sample[0]=(*buf)*256;
|
||||
sample[1]=(*buf)*256;
|
||||
}
|
||||
while (remainspace<4)
|
||||
{
|
||||
if (stage<1)
|
||||
{
|
||||
stage++;
|
||||
remainspace=locksz[stage];
|
||||
wrtptr=lockptr[stage];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lockptr[0])
|
||||
{
|
||||
_ds8Buffer->Unlock(lockptr[0],locksz[0],lockptr[1],locksz[1]);
|
||||
_lastWritePos+=LOCK_GRANUALITY;
|
||||
while (_lastWritePos>=BUFFER_SIZE) _lastWritePos-=BUFFER_SIZE;
|
||||
}
|
||||
DWORD playCursor;
|
||||
_ds8Buffer->GetCurrentPosition(&playCursor,0);
|
||||
if (playCursor<_lastWritePos) playCursor+=BUFFER_SIZE;
|
||||
while (playCursor-_lastWritePos<LOCK_GRANUALITY)
|
||||
{
|
||||
Sleep(200);
|
||||
_ds8Buffer->GetCurrentPosition(&playCursor,0);
|
||||
if (playCursor<_lastWritePos) playCursor+=BUFFER_SIZE;
|
||||
}
|
||||
HRESULT res=_ds8Buffer->Lock(_lastWritePos,LOCK_GRANUALITY,lockptr+0,locksz+0,lockptr+1,locksz+1,0);
|
||||
assert(res==0);
|
||||
stage=0;
|
||||
remainspace=locksz[stage];
|
||||
wrtptr=lockptr[stage];
|
||||
}
|
||||
}
|
||||
if (_crossfadebytes)
|
||||
{
|
||||
short *data=(short *)wrtptr;
|
||||
long a=data[0]+sample[0];
|
||||
if (a<-32767) a=-32767;
|
||||
if (a>32767) a=32767;
|
||||
data[0]=(short)a;
|
||||
a=data[1]+sample[1];
|
||||
if (a<-32767) a=-32767;
|
||||
if (a>32767) a=32767;
|
||||
data[1]=(short)a;
|
||||
if (_crossfadebytes<4) _crossfadebytes=0;else _crossfadebytes-=4;
|
||||
}
|
||||
else
|
||||
memcpy(wrtptr,sample,4);
|
||||
wrtptr=(void *)((char *)wrtptr+4);
|
||||
remainspace-=4;
|
||||
_minorpos+=_speed;
|
||||
while (_minorpos>=1024)
|
||||
{
|
||||
buf+=step;
|
||||
len-=step;
|
||||
_minorpos-=1024;
|
||||
}
|
||||
}
|
||||
if (stage==0) {locksz[1]=0;locksz[0]-=remainspace;}
|
||||
else {locksz[1]-=remainspace;}
|
||||
_ds8Buffer->Unlock(lockptr[0],locksz[0],lockptr[1],locksz[1]);
|
||||
_lastWritePos+=locksz[0]+locksz[1];
|
||||
while (_lastWritePos>=BUFFER_SIZE) _lastWritePos-=BUFFER_SIZE;
|
||||
LeaveCriticalSection(&_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MusicPlayer::CanWrite()
|
||||
{
|
||||
return LOCK_GRANUALITY;
|
||||
}
|
||||
int MusicPlayer::IsPlaying()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MusicPlayer::Pause(int pause)
|
||||
{
|
||||
int lastState=_paused?1:0;
|
||||
if (pause)
|
||||
{if (!_paused) {_ds8Buffer->Stop();_paused=true;}}
|
||||
else
|
||||
{if (_paused) {_ds8Buffer->Play(0,0,DSBPLAY_LOOPING);_paused=false;}}
|
||||
return lastState;
|
||||
}
|
||||
|
||||
|
||||
void MusicPlayer::SetVolume(int volume)
|
||||
{
|
||||
if (volume<0) return;
|
||||
_ds8Buffer->SetVolume(_linvoltable[volume]);
|
||||
if (volume==0)
|
||||
Pause(1);
|
||||
else
|
||||
Pause(0);
|
||||
}
|
||||
|
||||
MusDecoder::MusDecoder()
|
||||
{
|
||||
_playing=false;
|
||||
_thread=0;
|
||||
_stop=0;
|
||||
}
|
||||
|
||||
MusDecoder::~MusDecoder()
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
|
||||
void MusDecoder::AttachOutput(IWAOutput *o)
|
||||
{
|
||||
if (o) o->AddRef();
|
||||
if (_output) _output->Release();
|
||||
_output=o;
|
||||
}
|
||||
|
||||
bool MusDecoder::Play(const char *filename)
|
||||
{
|
||||
DWORD res=0;
|
||||
if (filename[0]=='?')
|
||||
{
|
||||
if (_output->Open(44100,1,8,-1,-1)<0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_stop=false;
|
||||
_playing=true;
|
||||
_thread=CreateThread(0,0,MusDecoder::StartSilentWritter,this,0,&res);
|
||||
return true;
|
||||
}
|
||||
_file=CreateFile(filename,GENERIC_READ,0,0,OPEN_EXISTING,FILE_FLAG_SEQUENTIAL_SCAN,0);
|
||||
if (_file==0) return false;
|
||||
ReadFile(_file,&_header,sizeof(_header),&res,0);
|
||||
if (res!=sizeof(_header)) {CloseHandle(_file);return false;}
|
||||
if (_output->Open(_header.freq,_header.channels,16,-1,-1)<0)
|
||||
{
|
||||
CloseHandle(_file);return false;
|
||||
}
|
||||
_stop=false;
|
||||
_playing=true;
|
||||
_thread=CreateThread(0,0,MusDecoder::StartMusDecoder,this,0,&res);
|
||||
return true;
|
||||
}
|
||||
|
||||
void MusDecoder::Stop()
|
||||
{
|
||||
if (_thread)
|
||||
{
|
||||
_stop=true;
|
||||
_output->Pause(0);
|
||||
WaitForSingleObject(_thread,INFINITE);
|
||||
CloseHandle(_thread);
|
||||
CloseHandle(_file);
|
||||
_output->Close();
|
||||
_file=0;
|
||||
_thread=0;
|
||||
}
|
||||
}
|
||||
|
||||
DWORD WINAPI MusDecoder::StartMusDecoder(LPVOID data)
|
||||
{
|
||||
MusDecoder *self=reinterpret_cast<MusDecoder *>(data);
|
||||
return self->MusDecodingThread();
|
||||
}
|
||||
|
||||
|
||||
|
||||
UINT MusDecoder::MusDecodingThread()
|
||||
{
|
||||
long blocksRemain=_header.blocks;
|
||||
char *packbuf=0;
|
||||
short *unpackbuf=0;
|
||||
long packbufsz=0;
|
||||
long unpackbufsz=0;
|
||||
for (int i=0;i<blocksRemain;i++)
|
||||
{
|
||||
if (_stop) break;
|
||||
long packedSize;
|
||||
long unpackedSize;
|
||||
DWORD bytesread;
|
||||
if (ReadFile(_file,&packedSize,sizeof(packedSize),&bytesread,NULL)==FALSE) break;
|
||||
if (ReadFile(_file,&unpackedSize,sizeof(unpackedSize),&bytesread,NULL)==FALSE) break;
|
||||
if (packbufsz<packedSize)
|
||||
{
|
||||
free(packbuf);
|
||||
packbuf=(char *)malloc(packedSize);
|
||||
packbufsz=packedSize;
|
||||
}
|
||||
if (unpackbufsz<unpackedSize || unpackbuf==0)
|
||||
{
|
||||
free(unpackbuf);
|
||||
unpackbuf=(short *)malloc(unpackedSize);
|
||||
unpackbufsz=unpackedSize;
|
||||
}
|
||||
if (ReadFile(_file,packbuf,packedSize,&bytesread,0)==FALSE) break;
|
||||
if (packedSize!=bytesread) break;
|
||||
short accum[2]={0,0};
|
||||
int channel=0;
|
||||
for (int i=0;i<packedSize;i++)
|
||||
{
|
||||
short val=accum[channel]+_header.ampltable[packbuf[i]];
|
||||
accum[channel]=val;
|
||||
if (packbuf[i]==0) //pridano jako provizorni reseni pro korekci chyby komprimacniho programu
|
||||
{
|
||||
val-=31767;
|
||||
}
|
||||
channel++;
|
||||
if (channel>=_header.channels) channel=0;
|
||||
unpackbuf[i]=val;
|
||||
}
|
||||
_output->Write(reinterpret_cast<char *>(unpackbuf),unpackedSize);
|
||||
}
|
||||
_playing=false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD WINAPI MusDecoder::StartSilentWritter(LPVOID data)
|
||||
{
|
||||
MusDecoder *self=reinterpret_cast<MusDecoder *>(data);
|
||||
return self->SilentWritterThread();
|
||||
}
|
||||
|
||||
UINT MusDecoder::SilentWritterThread()
|
||||
{
|
||||
char empty[1024];
|
||||
memset(empty,0,sizeof(empty));
|
||||
for (int i=0;i<1024;i++)
|
||||
{
|
||||
if (_stop) break;
|
||||
_output->Write(empty,1024);
|
||||
}
|
||||
_playing=false;
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
WinAmpDecoder::WinAmpDecoder()
|
||||
{
|
||||
_currPlugin=0;
|
||||
}
|
||||
|
||||
WinAmpDecoder::~WinAmpDecoder()
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
|
||||
void WinAmpDecoder::AttachOutput(IWAOutput *o)
|
||||
{
|
||||
if (o) o->AddRef();
|
||||
if (_output) _output->Release();
|
||||
_output=o;
|
||||
}
|
||||
|
||||
bool WinAmpDecoder::Play(const char *filename)
|
||||
{
|
||||
Stop();
|
||||
_currPlugin=SelectBestPlugin(filename);
|
||||
if (_currPlugin==0) return false;
|
||||
_currPlugin->AttachOutput(_output);
|
||||
if (_currPlugin->Play(filename)!=_currPlugin->errOk)
|
||||
{
|
||||
_currPlugin=0;
|
||||
return false;
|
||||
}
|
||||
int playtm=_currPlugin->GetOutputTime();
|
||||
int nexttm=playtm;
|
||||
int c=0;
|
||||
MusicPlayer *q=static_cast<MusicPlayer *>(_output);
|
||||
while (!q->IsOpenned() && playtm==nexttm && c<2000) {Sleep(1);c++;nexttm=_currPlugin->GetOutputTime();}
|
||||
_nooutput=!q->IsOpenned();
|
||||
return true;
|
||||
}
|
||||
|
||||
void WinAmpDecoder::Stop()
|
||||
{
|
||||
if (_currPlugin==0) return;
|
||||
_currPlugin->Stop();
|
||||
_currPlugin->AttachOutput(0);
|
||||
_currPlugin=0;
|
||||
}
|
||||
|
||||
bool WinAmpDecoder::IsPlaying()
|
||||
{
|
||||
if (_currPlugin==0) return false;
|
||||
return !_currPlugin->IsFinished();
|
||||
}
|
||||
|
||||
void WinAmpDecoder::SetVolume(int volume, int main)
|
||||
{
|
||||
_currPlugin->SetVolume(volume);
|
||||
}
|
121
Windows/Music.h
Normal file
121
Windows/Music.h
Normal file
|
@ -0,0 +1,121 @@
|
|||
#ifndef __SKELDAL_MUSIC_
|
||||
#define __SKELDAL_MUSIC_
|
||||
|
||||
#include "WAPlayer.h"
|
||||
|
||||
#define DWORD_PTR DWORD *
|
||||
#include <dsound.h>
|
||||
|
||||
|
||||
class MusicPlayer: public IWAOutput
|
||||
{
|
||||
DWORD _speed; //speed relative to sampling frequence;
|
||||
bool _stereo; //true, if stereo
|
||||
bool _bit16; //true, if 16 bits
|
||||
bool _opened;
|
||||
IDirectSoundBuffer8 *_ds8Buffer;
|
||||
DWORD _lastWritePos; //last write pos;
|
||||
DWORD _minorpos;
|
||||
int *_linvoltable;
|
||||
DWORD _crossfadebytes;
|
||||
unsigned char _volume;
|
||||
CRITICAL_SECTION _lock;
|
||||
bool _paused;
|
||||
|
||||
DWORD GetSafeXFadePos();
|
||||
|
||||
public:
|
||||
MusicPlayer();
|
||||
~MusicPlayer();
|
||||
|
||||
HRESULT InitBuffer(IDirectSound8 *ds8, int *linvoltable);
|
||||
HRESULT Play();
|
||||
HRESULT Done();
|
||||
int Open(int samplerate, int numchannels, int bitspersamp, int bufferlenms, int prebufferms);
|
||||
void Close();
|
||||
int Write(const char *buf, int len);
|
||||
int CanWrite();
|
||||
int IsPlaying();
|
||||
void SetVolume(int volume);
|
||||
void SetPan(int pan) {}
|
||||
void Flush(int t) {}
|
||||
int GetOutputTime() {return 1;}
|
||||
int GetWrittenTime() {return 1;}
|
||||
unsigned long AddRef() {return 1;}
|
||||
unsigned long Release() {return 1;}
|
||||
int Pause(int pause);
|
||||
bool IsOpenned() {return _opened;}
|
||||
};
|
||||
|
||||
#pragma pack (1)
|
||||
struct MusFileHeader
|
||||
{
|
||||
short channels;
|
||||
long freq;
|
||||
long ssize;
|
||||
long blocks;
|
||||
long reserved1;
|
||||
long reserved2;
|
||||
short ampltable[256];
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
|
||||
class IDecoder
|
||||
{
|
||||
public:
|
||||
virtual void AttachOutput(IWAOutput *o)=0;
|
||||
virtual bool Play(const char *filename)=0;
|
||||
virtual bool IsPlaying()=0;
|
||||
virtual void Stop()=0;
|
||||
virtual void SetVolume(int volume, int main)=0;
|
||||
virtual bool NotUsingOutput()=0;
|
||||
virtual ~IDecoder() {}
|
||||
};
|
||||
|
||||
class MusDecoder: public IDecoder
|
||||
{
|
||||
MusFileHeader _header;
|
||||
bool _playing;
|
||||
HANDLE _thread;
|
||||
IWAOutput *_output;
|
||||
HANDLE _file;
|
||||
bool _stop;
|
||||
|
||||
|
||||
static DWORD WINAPI StartMusDecoder(LPVOID data);
|
||||
static DWORD WINAPI StartSilentWritter(LPVOID data);
|
||||
UINT MusDecodingThread();
|
||||
UINT SilentWritterThread();
|
||||
public:
|
||||
MusDecoder();
|
||||
~MusDecoder();
|
||||
|
||||
void AttachOutput(IWAOutput *o);
|
||||
|
||||
bool Play(const char *filename);
|
||||
void Stop();
|
||||
bool IsPlaying() {return _playing;}
|
||||
void SetVolume(int volume, int main) {if (_output) _output->SetVolume(volume);}
|
||||
bool NotUsingOutput() {return false;}
|
||||
};
|
||||
|
||||
class WinAmpDecoder: public IDecoder, public WAPlayer
|
||||
{
|
||||
IWAOutput *_output;
|
||||
WAInputPlugin *_currPlugin;
|
||||
bool _nooutput;
|
||||
public:
|
||||
WinAmpDecoder();
|
||||
~WinAmpDecoder();
|
||||
|
||||
void AttachOutput(IWAOutput *o);
|
||||
bool Play(const char *filename);
|
||||
void Stop();
|
||||
bool IsPlaying();
|
||||
void SetVolume(int volume, int main);
|
||||
bool NotUsingOutput() {return _nooutput;}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
499
Windows/Skeldal.rc
Normal file
499
Windows/Skeldal.rc
Normal file
|
@ -0,0 +1,499 @@
|
|||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
#include <richedit.h>
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Czech resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CSY)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_CZECH, SUBLANG_DEFAULT
|
||||
#pragma code_page(1250)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"#include <richedit.h>\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SKELDAL_FONT
|
||||
//
|
||||
|
||||
IDR_BOLDCZ SKELDAL_FONT "..\\font\\BOLDCZ.FON"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_LADICIOKNO DIALOG 0, 0, 387, 221
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Ladicí okno"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
EDITTEXT IDC_OUTPUT,52,0,335,219,ES_MULTILINE | ES_AUTOVSCROLL |
|
||||
ES_AUTOHSCROLL | WS_VSCROLL | WS_HSCROLL
|
||||
PUSHBUTTON "&Nesmrtelnost",IDC_IMMORTAL,0,0,50,12
|
||||
PUSHBUTTON "Ne&teènost",IDC_NETECNOST,0,13,50,12
|
||||
PUSHBUTTON "Jít na &sektor",IDC_GOTO,0,26,50,12
|
||||
PUSHBUTTON "Jiná &mapa",IDC_LOADMAP,0,39,50,12
|
||||
PUSHBUTTON "&Pøedmìt",IDC_LOADITEM,0,52,50,12
|
||||
PUSHBUTTON "&Dej Peníze",IDC_TAKEMONEY,0,65,50,12
|
||||
PUSHBUTTON "Post&up",IDC_ADVENCE,0,78,50,12
|
||||
PUSHBUTTON "&Bonus zbraní",IDC_WEAPONSKILL,0,91,50,12
|
||||
PUSHBUTTON "Oži&vit nestv.",IDC_RAISEMONSTER,0,104,50,12
|
||||
PUSHBUTTON "Ož&ivit postavu",IDC_RAISEDEATH,0,117,50,12
|
||||
PUSHBUTTON "Léèit postavu",IDC_HEAL,0,130,50,12
|
||||
PUSHBUTTON "&Otevøít dveøe",IDC_OPENDOOR,0,143,50,12
|
||||
PUSHBUTTON "Èistit m&apu",IDC_CLEARMAP,0,156,50,12
|
||||
PUSHBUTTON "&Zruš magii",IDC_UNAFFECT,0,169,50,12
|
||||
PUSHBUTTON "Naèti n&estv.",IDC_RELOADMOBILES,0,182,50,12
|
||||
PUSHBUTTON "Pur&ge",IDC_PURGE,0,195,50,12
|
||||
PUSHBUTTON "&Refresh",IDC_REFRESH,0,208,50,12
|
||||
END
|
||||
|
||||
IDD_INPUTWINDOW DIALOG 0, 0, 264, 30
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Vztupní okno"
|
||||
FONT 7, "Small Fonts"
|
||||
BEGIN
|
||||
LTEXT "Prompt",IDC_PROMPT,0,0,211,15
|
||||
EDITTEXT IDC_VALUE,0,16,213,14,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "OK",IDOK,214,0,50,14
|
||||
PUSHBUTTON "Storno",IDCANCEL,214,16,50,14
|
||||
END
|
||||
|
||||
IDD_CFGTABDIALOG DIALOG 0, 0, 243, 255
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION |
|
||||
WS_SYSMENU
|
||||
CAPTION "Nastavení"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "Tab1",IDC_TAB,"SysTabControl32",WS_TABSTOP,7,7,229,224
|
||||
LTEXT "Tomuto zobrazení\nodpovídá žádná položka",
|
||||
IDC_CLIENTDESK,14,26,213,195
|
||||
DEFPUSHBUTTON "OK",IDOK,122,234,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,179,234,50,14
|
||||
END
|
||||
|
||||
IDD_CFGGENERAL DIALOGEX 0, 0, 200, 190
|
||||
STYLE DS_SETFONT | DS_CONTROL | WS_CHILD
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
CONTROL "Spouštìt hru v oknì",IDC_WINDOWED,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,25,13,80,10
|
||||
CONTROL "640x480",IDC_ZOOM1,"Button",BS_AUTORADIOBUTTON |
|
||||
WS_GROUP | WS_TABSTOP,41,25,43,10
|
||||
CONTROL "960x720",IDC_ZOOM2,"Button",BS_AUTORADIOBUTTON,41,36,43,
|
||||
10
|
||||
CONTROL "1280x960",IDC_ZOOM3,"Button",BS_AUTORADIOBUTTON,41,47,
|
||||
47,10
|
||||
CONTROL "Výchozí monitor",IDC_MON1,"Button",BS_AUTORADIOBUTTON |
|
||||
WS_GROUP | WS_TABSTOP,119,25,66,10
|
||||
CONTROL "Druhý monitor",IDC_MON2,"Button",BS_AUTORADIOBUTTON,119,
|
||||
36,59,10
|
||||
CONTROL "Tøetí monitor",IDC_MON3,"Button",BS_AUTORADIOBUTTON,119,
|
||||
47,56,10
|
||||
CONTROL "Vždy naèíst celou úroveò do pamìti",IDC_PRELOAD,"Button",
|
||||
BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,26,62,129,10
|
||||
CONTROL "Povolit automatické ukládání na poslední pozici",
|
||||
IDC_AUTOSAVE,"Button",BS_AUTOCHECKBOX | WS_GROUP |
|
||||
WS_TABSTOP,25,74,166,10
|
||||
LTEXT "Rychlost hry:",IDC_STATIC,21,102,42,8
|
||||
CTEXT "??",IDC_GAMESPEEDINFO,67,102,40,8
|
||||
CONTROL "Slider1",IDC_GAMESPEED,"msctls_trackbar32",
|
||||
TBS_AUTOTICKS | WS_TABSTOP,20,115,159,18
|
||||
LTEXT "Pomalu",IDC_STATIC,18,133,24,8
|
||||
LTEXT "Rychle",IDC_STATIC,162,133,23,8
|
||||
LTEXT "Urychlit bitvy:",IDC_STATIC,20,146,43,18,SS_CENTERIMAGE
|
||||
CONTROL "Slider1",IDC_BATTLEACC,"msctls_trackbar32",
|
||||
TBS_AUTOTICKS | WS_TABSTOP,70,146,109,18
|
||||
PUSHBUTTON "Výchozí",IDC_GAMESPEEDDEFAULT,143,168,50,14
|
||||
END
|
||||
|
||||
IDD_CFGSOUND DIALOGEX 0, 0, 214, 195
|
||||
STYLE DS_SETFONT | DS_CONTROL | WS_CHILD
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "&Mixovací frekvence:",IDC_STATIC,20,15,66,12,
|
||||
SS_CENTERIMAGE
|
||||
EDITTEXT IDC_MIXFREQ,88,15,51,12,ES_CENTER | ES_AUTOHSCROLL |
|
||||
ES_NUMBER
|
||||
LTEXT "Hz",IDC_STATIC,140,15,10,12,SS_CENTERIMAGE
|
||||
GROUPBOX "",IDC_STATIC,7,30,200,72
|
||||
LTEXT "Pozor: Nastavení hlasitostí se ukládá do herních pozic. Nastavení mùže být zmìnìno, pøi naètení hry z pozice. Zmìnu nastavení pro pozici proveïte ve høe:",
|
||||
IDC_STATIC,19,38,173,27
|
||||
LTEXT "&Hudba:",IDC_STATIC,19,67,29,15,SS_CENTERIMAGE
|
||||
CONTROL "Slider1",IDC_SNDMUSIC,"msctls_trackbar32",TBS_BOTH |
|
||||
TBS_NOTICKS | WS_TABSTOP,55,67,130,15
|
||||
LTEXT "&Skøeky",IDC_STATIC,19,83,29,15,SS_CENTERIMAGE
|
||||
CONTROL "Slider1",IDC_SNDFX,"msctls_trackbar32",TBS_BOTH |
|
||||
TBS_NOTICKS | WS_TABSTOP,55,83,130,15
|
||||
LTEXT "Pluginy",IDC_STATIC,7,111,24,12,SS_CENTERIMAGE
|
||||
PUSHBUTTON "Cesta na pluginy",IDC_CESTANAPLUGINY,36,111,171,12,
|
||||
BS_FLAT
|
||||
LISTBOX IDC_PLUGLIST,7,130,200,45,LBS_SORT |
|
||||
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "Vlastnosti",IDC_PLUGVLASTNOSTI,168,177,39,11
|
||||
/* PUSHBUTTON "Nápovìda",IDC_PLUGINYNAPOVEDA,168,177,39,11*/
|
||||
LTEXT "Pozor: Vyžaduje pluginy z WinAmp 2.95 !!!\r\nLze získat na http://skeldal.jinak.cz",
|
||||
IDC_STATIC,7,176,158,16
|
||||
END
|
||||
|
||||
IDD_CFGVIDEO DIALOG 0, 0, 152, 76
|
||||
STYLE DS_SETFONT | DS_CONTROL | WS_CHILD
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "Nepøehrávej intro pøi startu",IDC_SKIPINTRO,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,23,25,100,10
|
||||
CONTROL "Nezobrazuj video prokládanì",IDC_FULLRESVIDEO,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,23,44,108,10
|
||||
END
|
||||
|
||||
IDD_CFGEXTRAS DIALOG 0, 0, 203, 198
|
||||
STYLE DS_SETFONT | DS_CONTROL | WS_CHILD
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "Náhodný backfire (pøi kouzlení)",IDC_EXRANDOMBACKFIRES,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,115,10
|
||||
CONTROL "Recykluj nestvùry (zabité nestvùry se èasem obnoví)",
|
||||
IDC_EXRESPAWNMONSTERS,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,7,20,189,10
|
||||
CONTROL "Alternativni bojový systém",IDC_EXALTERNATEFIGHT,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,33,97,10
|
||||
CONTROL "Vracej do hry znièené nebo utopené pøedmìty",
|
||||
IDC_EXRECORVERITEMS,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,7,46,161,10
|
||||
CONTROL "Vloží pøedmìty ze zemì do batohu pomocí CTRL",
|
||||
IDC_EXBAGEXTENDED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
|
||||
7,59,189,10
|
||||
CONTROL "Lepší výhody štítù pøi soubojích",IDC_EXSHIELDBLOCKING,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,72,116,10
|
||||
CONTROL "Rychlejší obchodování pøi použití CTRL",IDC_EXFASTTRADE,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,85,142,10
|
||||
CONTROL "Zobrazuj minimapu i mimo boj",IDC_EXALWAYSMINIMAP,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,98,107,10
|
||||
CONTROL "Hromadný útìk z boje",IDC_EXGROUPFLEE,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,111,85,10
|
||||
CONTROL "Vždy otevøi knihu pøi jejího zmìnì obsahu",
|
||||
IDC_EXAUTOOPENBOOK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
|
||||
7,124,147,10
|
||||
CONTROL "Vždy zobraz sebranou runu",IDC_EXAUTOSHOWRUNE,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,137,101,10
|
||||
PUSHBUTTON "Nápovìda",IDC_EXTRASHELP,129,177,67,14
|
||||
CONTROL "Malé nestvùry chodí také diagonálnì",IDC_EXMOBDIAGONAL,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,150,133,10
|
||||
END
|
||||
|
||||
IDD_CFGCHEATS DIALOG 0, 0, 169, 139
|
||||
STYLE DS_SETFONT | DS_CONTROL | WS_CHILD
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "Vypni hladovìní a žízeò",IDC_NOHUNGRY,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,43,22,91,10
|
||||
CONTROL "Povol ladící okno",IDC_DEBUGCONSOLE,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,43,43,71,10
|
||||
CTEXT "Ladící okno funguje jen u map, které nejsou zabezpeèené heslem\n\nToto omezení lze zrušit zadáním univerzálního cheatovacího hesla",
|
||||
IDC_STATIC,7,70,155,43
|
||||
EDITTEXT IDC_CHEATPASSWORD,7,118,155,14,ES_CENTER | ES_PASSWORD |
|
||||
ES_AUTOHSCROLL | ES_NUMBER
|
||||
END
|
||||
|
||||
IDD_RTFVIEWER DIALOG 0, 0, 311, 313
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Brány Skeldalu "
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,254,292,50,14
|
||||
CONTROL "",IDC_RICHEDIT,"RichEdit20A",ES_MULTILINE |
|
||||
ES_AUTOVSCROLL | ES_NOHIDESEL | ES_READONLY | WS_BORDER |
|
||||
WS_VSCROLL | WS_TABSTOP,7,7,297,276
|
||||
END
|
||||
|
||||
IDD_SELADV DIALOG 0, 0, 106, 149
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION |
|
||||
WS_SYSMENU
|
||||
CAPTION "SKELDAL - Vyber dobrodružství"
|
||||
FONT 10, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "START!",IDOK,3,120,47,14
|
||||
PUSHBUTTON "Storno",IDCANCEL,56,120,47,14
|
||||
LISTBOX IDC_LIST,3,69,100,49,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS |
|
||||
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Vytvoøit zástupce na ploše",IDC_CREATELINK,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,3,136,100,10
|
||||
CONTROL 130,IDC_STATIC,"Static",SS_BITMAP,3,3,100,60
|
||||
END
|
||||
|
||||
IDD_LISTDIALOG DIALOGEX 0, 0, 208, 191
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Vyber"
|
||||
FONT 8, "Courier", 400, 0, 0xEE
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,7,170,194,14
|
||||
LISTBOX IDC_LIST,7,7,194,146,LBS_NOINTEGRALHEIGHT |
|
||||
LBS_EXTENDEDSEL | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Hodnota",IDC_STATIC,7,154,31,12,SS_CENTERIMAGE
|
||||
EDITTEXT IDC_HODNOTA,41,154,160,12,ES_AUTOHSCROLL | WS_DISABLED
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_LADICIOKNO, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 380
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 214
|
||||
END
|
||||
|
||||
IDD_CFGTABDIALOG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 236
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 248
|
||||
END
|
||||
|
||||
IDD_CFGGENERAL, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 193
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 183
|
||||
END
|
||||
|
||||
IDD_CFGSOUND, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 207
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 188
|
||||
END
|
||||
|
||||
IDD_CFGVIDEO, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 145
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 69
|
||||
END
|
||||
|
||||
IDD_CFGEXTRAS, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 196
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 191
|
||||
END
|
||||
|
||||
IDD_CFGCHEATS, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 162
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 132
|
||||
END
|
||||
|
||||
IDD_RTFVIEWER, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 304
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 306
|
||||
END
|
||||
|
||||
IDD_SELADV, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 3
|
||||
RIGHTMARGIN, 103
|
||||
TOPMARGIN, 3
|
||||
BOTTOMMARGIN, 146
|
||||
END
|
||||
|
||||
IDD_LISTDIALOG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 201
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 184
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDB_INITLOGO BITMAP "logo.bmp"
|
||||
IDB_UVODNIPOZADI BITMAP "uvodni.bmp"
|
||||
IDB_UVODNISELECT BITMAP "uvodni_sel.bmp"
|
||||
IDB_SELADVDLG BITMAP "seladv_male.bmp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_MAINICON ICON "icon.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// RTF
|
||||
//
|
||||
|
||||
IDR_EXTRAS RTF "extras.rtf"
|
||||
IDR_WINAMPPLUGS RTF "plugins.rtf"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
#include "..\game\version.h"
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
VERSIONWINRES(FILEVERSION)
|
||||
VERSIONWINRES(PRODUCTVERSION)
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040504b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "Brány Skeldalu pro Windows"
|
||||
VALUE "CompanyName", "Bredysoft"
|
||||
VALUE "FileDescription", "Brány Skeldalu pro Windows"
|
||||
VALUE "FileVersion", "1"
|
||||
VALUE "InternalName", "Skeldal"
|
||||
VALUE "LegalCopyright", "Copyright Bredysoft (C) 2005"
|
||||
VALUE "LegalTrademarks", "Bredysoft"
|
||||
VALUE "OriginalFilename", "Skeldal.exe"
|
||||
VALUE "ProductName", " Skeldal"
|
||||
VALUE "ProductVersion", "1"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x405, 1200
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_CFGGENERAL "Obecné"
|
||||
IDS_CFGSOUND "Zvuk"
|
||||
IDS_CFGVIDEO "Video"
|
||||
IDS_CFGEXTRAS "Rozšíøení"
|
||||
IDS_CFGCHEATS "Cheaty"
|
||||
IDS_NICVYBRANO "Musíš nìco vybrat v seznamu."
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_WINTITLE "Brány Skeldalu Windows verze"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_CHEATWARNING1 "Upozornìní: Zapínání cheatù mùže zkazit celkový dojem hry, a mùže zpùsobit, že hra nebude bez použití cheatù dohratelná. Chcete opravdu povolit cheaty?"
|
||||
IDS_CHEATWARNING2 "Bylo vám oznámeno, že cheaty vám opravdu mohou pøi hraní zkazit zábavu. Berete-li toto na vìdomí, stisknìte OK"
|
||||
IDS_CHEATWARNING3 "Pøedchozí zprávu jste nevzal na vìdomí. Pøesto si prosím uvìdomte, že zapínání cheatu vede ke snížení hratelnosti a tím pádem zábavy ze hraní. Rozhodnì toto provádíte na vlastní riziko. Chcete pøesto opakovat své stanovisko?"
|
||||
IDS_CHEATWARNING4 "Zcela evidentnì ignorujete varování, že cheaty mohou velice snížit zábavu z hraní. Budete v tom pokraèovat i nadále?"
|
||||
IDS_CHEATWARNING5 "Byl jste varován!"
|
||||
IDS_RICHEDMISSING "Chybí propojovací knihovna RICHED20.DLL. Selhalo zobrazení okna"
|
||||
IDS_MIXFREQINVALID "Mixovaci frekvence je mimo povoleny rozsah (8000-44100). Hodnota nebude uložena."
|
||||
IDS_SCREENBPPWARNING "Plocha nepracuje v režimu 16bpp (65536 barev). Pro spuštìní hry je nutné pracovní plochu pøepnout do tohoto režimu. Pøepnutí se provede automaticky a po ukonèení hry se provede obnova nastavení plochy. Pokud by spuštìní hry v oknì zpùsobovalo obtíže, napøíklad by obrazovka zèernala, nebo by se obraz rozpadl, zkuste stisknou Alt+F4. Pak bude nutné pøed spuštìním hry v oknì provést zmìnu nastavení plochy ruènì, nebo hru spouštìt na celou obrazovku."
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_INSTALLFILTER "Složky|vyberslozky.$$$slozky$$$||"
|
||||
IDS_INSTALLTITLE "Vyber lokaci, kam chceš hru nainstalovat"
|
||||
IDS_INSTALLPRENAME "Brány Skeldalu"
|
||||
IDS_INSTALLCDFILE "INSTALL.INF"
|
||||
IDS_INSTALLCDTITLE "Kde se nachází instalaèní CD?"
|
||||
IDS_INSTALLCDFILTER "Instalaèní CD Brány Skeldalu|install.inf||"
|
||||
IDS_CREATEDIR "Složka %s neexistuje. Chcete jí vytvoøit?"
|
||||
IDS_NELZEVYTVORITSLOZKU "Nelze vytvoøit složku %s"
|
||||
IDS_INSTALLEDGAME "Hra je nainstalovaná. Byl vytvoøen zástupce na ploše. Nyní mùžeš hru spustit."
|
||||
IDS_INSTALLHDD "Pøeješ si instalovat hru na pevný disk?\r\n\r\n* Odpovìï ANO zkopíruje všechny potøebné soubory na pevný disk (asi 300MB)\r\n* Odpovìï NE umožní hrát hru z CD (šetøí místo na pevném disku)"
|
||||
IDS_INSTALLCHYBISOUBOR "Chybi soubor(y): %s"
|
||||
IDS_INSTALLTEXT1 "Instalace hry Brány Skeldalu krok 1.\r\n\r\nPøed zapoèetím instalace vložte do jednotky originální CD hry a v oknì, jenž se objeví po odklepnutí tlaèítka OK,vyhledejte vyjmenovaný soubor, který se na CD nalézá."
|
||||
IDS_INSTALLTEXT2 "Instalace hry Brány Skeldalu krok 2.\r\n\r\nNyní je tøeba urèit lokaci, kam se hra nainstaluje. V následujícím oknì vyberte nejvhodnìjší umístìní. Jméno složky mùžete pozmìnit v dolní èásti okna"
|
||||
IDS_DEFAULTADV "Rovenland - Brány Skeldalu"
|
||||
END
|
||||
|
||||
#endif // Czech resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
8
Windows/StdAfx.cpp
Normal file
8
Windows/StdAfx.cpp
Normal file
|
@ -0,0 +1,8 @@
|
|||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// WinAmpInterface.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: reference any additional headers you need in STDAFX.H
|
||||
// and not in this file
|
26
Windows/StdAfx.h
Normal file
26
Windows/StdAfx.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#if !defined(AFX_STDAFX_H__C6160DCF_A5D8_42D0_8EAB_F594D354BFCB__INCLUDED_)
|
||||
#define AFX_STDAFX_H__C6160DCF_A5D8_42D0_8EAB_F594D354BFCB__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#include <stdio.h>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <conio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// TODO: reference additional headers your program requires here
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_STDAFX_H__C6160DCF_A5D8_42D0_8EAB_F594D354BFCB__INCLUDED_)
|
632
Windows/WAInputPlugin.cpp
Normal file
632
Windows/WAInputPlugin.cpp
Normal file
|
@ -0,0 +1,632 @@
|
|||
// WAInputPlugin.cpp: implementation of the WAInputPlugin class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "WAInputPlugin.h"
|
||||
#include <malloc.h>
|
||||
#include <direct.h>
|
||||
#include "wa_ipc.h"
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define MAX_PLUGINS_AT_TIME 16
|
||||
|
||||
#define DECLARE_TEMPLATES(x) \
|
||||
x(0)\
|
||||
x(1)\
|
||||
x(2)\
|
||||
x(3)\
|
||||
x(4)\
|
||||
x(5)\
|
||||
x(6)\
|
||||
x(7)\
|
||||
x(8)\
|
||||
x(9)\
|
||||
x(10)\
|
||||
x(11)\
|
||||
x(12)\
|
||||
x(13)\
|
||||
x(14)\
|
||||
x(15)\
|
||||
/* x(16)\
|
||||
x(17)\
|
||||
x(18)\
|
||||
x(19)\
|
||||
x(20)\
|
||||
x(21)\
|
||||
x(22)\
|
||||
x(23)\
|
||||
x(24)\
|
||||
x(25)\
|
||||
x(26)\
|
||||
x(27)\
|
||||
x(28)\
|
||||
x(29)\
|
||||
x(30)\
|
||||
x(31)\*/
|
||||
|
||||
|
||||
#define JOIN(x,y) &x##y
|
||||
|
||||
#define DECLARE_TEMPLATE_ARRAYS(x) \
|
||||
static void *p_##x[]={JOIN(x,_0),JOIN(x,_1),JOIN(x,_2),JOIN(x,_3),JOIN(x,_4),JOIN(x,_5),JOIN(x,_6),JOIN(x,_7),\
|
||||
JOIN(x,_8),JOIN(x,_9),JOIN(x,_10),JOIN(x,_11),JOIN(x,_12),JOIN(x,_13),JOIN(x,_14),JOIN(x,_15)/*,\
|
||||
JOIN(x,_16),JOIN(x,_17),JOIN(x,_18),JOIN(x,_19),JOIN(x,_20),JOIN(x,_21),JOIN(x,_22),JOIN(x,_23),\
|
||||
JOIN(x,_24),JOIN(x,_25),JOIN(x,_26),JOIN(x,_27),JOIN(x,_28),JOIN(x,_29),JOIN(x,_30),JOIN(x,_31)*/\
|
||||
};
|
||||
|
||||
|
||||
WAInputPlugin::WAInputPlugin()
|
||||
{
|
||||
_inPlugin=0;
|
||||
_mod=0;
|
||||
_ioutput=0;
|
||||
_finished=false;
|
||||
_hNotify=0;
|
||||
}
|
||||
|
||||
WAInputPlugin::~WAInputPlugin()
|
||||
{
|
||||
UnloadPlugin();
|
||||
}
|
||||
|
||||
typedef In_Module * (*type_winampGetInModule2)();
|
||||
|
||||
static void empty_SAVSAInit(int maxlatency_in_ms, int srate)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void empty_SAVSADeInit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void empty_SAAddPCMData(void *PCMData, int nch, int bps, int timestamp)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static int empty_SAGetMode()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void empty_SAAdd(void *data, int timestamp, int csa)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void empty_VSAAddPCMData(void *PCMData, int nch, int bps, int timestamp)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void empty_VSAAdd(void *data, int timestamp)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static int empty_VSAGetMode(int *specNch, int *waveNch)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void empty_VSASetInfo(int nch, int srate)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static int empty_dsp_isactive()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int empty_dsp_dosamples(short int *samples, int numsamples, int bps, int nch, int srate)
|
||||
{
|
||||
return numsamples;
|
||||
}
|
||||
|
||||
static void empty_SetInfo(int bitrate, int srate, int stereo, int synched)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void empty_About(HWND hWnd)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void empty_Config(HWND hWnd)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void empty_Init()
|
||||
{
|
||||
|
||||
}
|
||||
static void empty_Quit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
class RegistredPlugsArray
|
||||
{
|
||||
WAInputPlugin *_arr[MAX_PLUGINS_AT_TIME];
|
||||
public:
|
||||
RegistredPlugsArray() {memset(_arr,0,sizeof(_arr));}
|
||||
int Register(WAInputPlugin *plug);
|
||||
void Unregister(WAInputPlugin *plug);
|
||||
WAInputPlugin *operator[] (int index) {return _arr[index];}
|
||||
};
|
||||
|
||||
int RegistredPlugsArray::Register(WAInputPlugin *plug)
|
||||
{
|
||||
for (int i=0;i<MAX_PLUGINS_AT_TIME;i++) if (_arr[i]==0)
|
||||
{
|
||||
_arr[i]=plug;
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void RegistredPlugsArray::Unregister(WAInputPlugin *plug)
|
||||
{
|
||||
for (int i=0;i<MAX_PLUGINS_AT_TIME;i++) if (_arr[i]==plug) _arr[i]=0;
|
||||
}
|
||||
|
||||
static RegistredPlugsArray GRegistredPlugsArray;
|
||||
|
||||
#define m_Open(index)\
|
||||
static int output_Open_##index(int samplerate, int numchannels, int bitspersamp, int bufferlenms, int prebufferms)\
|
||||
{\
|
||||
IWAOutput *o=GRegistredPlugsArray[index]->GetAttachedOutputNoAddRef();\
|
||||
if (o) return o->Open(samplerate, numchannels, bitspersamp, bufferlenms, prebufferms);\
|
||||
return -1;\
|
||||
}
|
||||
|
||||
#define m_Close(index)\
|
||||
static void output_Close_##index()\
|
||||
{\
|
||||
IWAOutput *o=GRegistredPlugsArray[index]->GetAttachedOutputNoAddRef();\
|
||||
if (o) o->Close();\
|
||||
}
|
||||
|
||||
#define m_Write(index)\
|
||||
static int output_Write_##index(char *buff, int len)\
|
||||
{\
|
||||
IWAOutput *o=GRegistredPlugsArray[index]->GetAttachedOutputNoAddRef();\
|
||||
if (o) return o->Write(buff,len);\
|
||||
return 1;\
|
||||
}
|
||||
|
||||
#define m_CanWrite(index)\
|
||||
static int output_CanWrite_##index()\
|
||||
{\
|
||||
IWAOutput *o=GRegistredPlugsArray[index]->GetAttachedOutputNoAddRef();\
|
||||
if (o) return o->CanWrite();\
|
||||
return 0;\
|
||||
}
|
||||
|
||||
#define m_IsPlaying(index)\
|
||||
static int output_IsPlaying_##index()\
|
||||
{\
|
||||
IWAOutput *o=GRegistredPlugsArray[index]->GetAttachedOutputNoAddRef();\
|
||||
int p=o->IsPlaying();\
|
||||
return p;\
|
||||
}
|
||||
|
||||
#define m_Pause(index)\
|
||||
static int output_Pause_##index(int pause)\
|
||||
{\
|
||||
IWAOutput *o=GRegistredPlugsArray[index]->GetAttachedOutputNoAddRef();\
|
||||
if (o) return o->Pause(pause);\
|
||||
return 0;\
|
||||
}
|
||||
|
||||
#define m_SetVolume(index)\
|
||||
static void output_SetVolume_##index(int volume)\
|
||||
{\
|
||||
IWAOutput *o=GRegistredPlugsArray[index]->GetAttachedOutputNoAddRef();\
|
||||
if (o) o->SetVolume(volume);\
|
||||
}
|
||||
|
||||
#define m_SetPan(index)\
|
||||
static void output_SetPan_##index(int pan)\
|
||||
{\
|
||||
IWAOutput *o=GRegistredPlugsArray[index]->GetAttachedOutputNoAddRef();\
|
||||
if (o) o->SetPan(pan);\
|
||||
}
|
||||
|
||||
#define m_Flush(index)\
|
||||
static void output_Flush_##index(int t)\
|
||||
{\
|
||||
IWAOutput *o=GRegistredPlugsArray[index]->GetAttachedOutputNoAddRef();\
|
||||
if (o) o->Flush(t);\
|
||||
}
|
||||
|
||||
#define m_GetOutputTime(index)\
|
||||
static int output_GetOutputTime_##index()\
|
||||
{\
|
||||
IWAOutput *o=GRegistredPlugsArray[index]->GetAttachedOutputNoAddRef();\
|
||||
if (o) return o->GetOutputTime();\
|
||||
return 0;\
|
||||
}
|
||||
|
||||
#define m_GetWrittenTime(index)\
|
||||
static int output_GetWrittenTime_##index()\
|
||||
{\
|
||||
IWAOutput *o=GRegistredPlugsArray[index]->GetAttachedOutputNoAddRef();\
|
||||
if (o) return o->GetWrittenTime();\
|
||||
return 0;\
|
||||
}
|
||||
|
||||
DECLARE_TEMPLATES(m_Open);
|
||||
DECLARE_TEMPLATES(m_Close);
|
||||
DECLARE_TEMPLATES(m_Write);
|
||||
DECLARE_TEMPLATES(m_CanWrite);
|
||||
DECLARE_TEMPLATES(m_IsPlaying);
|
||||
DECLARE_TEMPLATES(m_Pause);
|
||||
DECLARE_TEMPLATES(m_SetVolume);
|
||||
DECLARE_TEMPLATES(m_SetPan);
|
||||
DECLARE_TEMPLATES(m_Flush);
|
||||
DECLARE_TEMPLATES(m_GetOutputTime);
|
||||
DECLARE_TEMPLATES(m_GetWrittenTime);
|
||||
|
||||
DECLARE_TEMPLATE_ARRAYS(output_Open);
|
||||
DECLARE_TEMPLATE_ARRAYS(output_Close);
|
||||
DECLARE_TEMPLATE_ARRAYS(output_Write);
|
||||
DECLARE_TEMPLATE_ARRAYS(output_CanWrite);
|
||||
DECLARE_TEMPLATE_ARRAYS(output_IsPlaying);
|
||||
DECLARE_TEMPLATE_ARRAYS(output_Pause);
|
||||
DECLARE_TEMPLATE_ARRAYS(output_SetVolume);
|
||||
DECLARE_TEMPLATE_ARRAYS(output_SetPan);
|
||||
DECLARE_TEMPLATE_ARRAYS(output_Flush);
|
||||
DECLARE_TEMPLATE_ARRAYS(output_GetOutputTime);
|
||||
DECLARE_TEMPLATE_ARRAYS(output_GetWrittenTime);
|
||||
|
||||
|
||||
WAInputPlugin::PluginError WAInputPlugin::UIConfig(HWND parentHwnd)
|
||||
{
|
||||
if (_inPlugin==0) return errNotLoaded;
|
||||
_inPlugin->Config(parentHwnd);
|
||||
return errOk;
|
||||
}
|
||||
|
||||
WAInputPlugin::PluginError WAInputPlugin::UIAbout(HWND parentHwnd)
|
||||
{
|
||||
if (_inPlugin==0) return errNotLoaded;
|
||||
_inPlugin->About(parentHwnd);
|
||||
return errOk;
|
||||
}
|
||||
|
||||
WAInputPlugin::PluginError WAInputPlugin::UnloadPlugin()
|
||||
{
|
||||
if (_inPlugin!=0)
|
||||
{
|
||||
__try
|
||||
{
|
||||
_inPlugin->Quit();
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
_mod=0; //prevent calling FreeLibrary.... plugin cannot be unloaded....
|
||||
}
|
||||
_inPlugin=0;
|
||||
}
|
||||
if (_hNotify)
|
||||
{
|
||||
DestroyWindow(_hNotify);
|
||||
_hNotify=0;
|
||||
}
|
||||
if (_mod)
|
||||
{
|
||||
FreeLibrary(_mod);
|
||||
_mod=0;
|
||||
}
|
||||
return errOk;
|
||||
}
|
||||
|
||||
WAInputPlugin::PluginError WAInputPlugin::IsLoaded()
|
||||
{
|
||||
if (_inPlugin==0) return errNotLoaded;
|
||||
return errOk;
|
||||
}
|
||||
|
||||
const char *WAInputPlugin::GetDescription()
|
||||
{
|
||||
if (_inPlugin==0) return 0;
|
||||
return _inPlugin->description;
|
||||
}
|
||||
|
||||
WAInputPlugin::PluginError WAInputPlugin::GetFileInfo(const char *filename, char *title, int title_size, int *len_in_ms)
|
||||
{
|
||||
if (_inPlugin==0) return errNotLoaded;
|
||||
char *buff=new char[4096];
|
||||
DWORD r=GetTickCount();
|
||||
memcpy(buff+4092,&r,4);
|
||||
_inPlugin->GetFileInfo(const_cast<char *>(filename),buff,len_in_ms);
|
||||
if (memcmp(buff+4092,&r,4)==0)
|
||||
{
|
||||
return errPluginBufferOverrun;
|
||||
}
|
||||
int len=strlen(buff);
|
||||
if (len>=title_size)
|
||||
{
|
||||
strncpy(title,buff,title_size);
|
||||
return errBufferTooSmall;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(title,buff);
|
||||
return errOk;
|
||||
}
|
||||
}
|
||||
|
||||
WAInputPlugin::PluginError WAInputPlugin::UIFileInfo(const char *filename, HWND parentHwnd)
|
||||
{
|
||||
if (_inPlugin==0) return errNotLoaded;
|
||||
_inPlugin->InfoBox(const_cast<char *>(filename),parentHwnd);
|
||||
return errOk;
|
||||
}
|
||||
|
||||
WAInputPlugin::PluginError WAInputPlugin::CanPlayFile(const char *filename)
|
||||
{
|
||||
if (_inPlugin==0) return errNotLoaded;
|
||||
if (_inPlugin->IsOurFile(const_cast<char *>(filename))) return errOk;
|
||||
char *fext=_inPlugin->FileExtensions;
|
||||
const char *bslash=strrchr(filename,'\\');
|
||||
if (bslash==0) bslash=filename;
|
||||
const char *ext=strrchr(bslash,'.');
|
||||
if (ext==0) ext=strchr(bslash,0);
|
||||
else ext++;
|
||||
int extlen=strlen(ext);
|
||||
while (*fext)
|
||||
{
|
||||
if (strnicmp(fext,ext,extlen)==0 && (fext[extlen]==';' || fext[extlen]==0))
|
||||
return errOk;
|
||||
char *c=strchr(fext,';');
|
||||
if (c==0)
|
||||
{
|
||||
c=strchr(fext,0);
|
||||
c++;
|
||||
if (*c) c=strchr(c,0)+1;
|
||||
fext=c;
|
||||
}
|
||||
else
|
||||
fext=c+1;
|
||||
}
|
||||
return errUnknownFileFormat;
|
||||
}
|
||||
|
||||
WAInputPlugin::PluginError WAInputPlugin::AttachOutput(IWAOutput *o)
|
||||
{
|
||||
if (_ioutput==o) return errOk;
|
||||
if ((_ioutput!=0)!=(o!=0))
|
||||
{
|
||||
if (o==0) GRegistredPlugsArray.Unregister(this);
|
||||
else
|
||||
{
|
||||
int plugid=GRegistredPlugsArray.Register(this);
|
||||
if (plugid==-1) return errTooManyPlugins;
|
||||
|
||||
_output.About=empty_About;
|
||||
_output.Config=empty_Config;
|
||||
_output.Init=empty_Init;
|
||||
_output.Quit=empty_Quit;
|
||||
*(void **)&_output.CanWrite=p_output_CanWrite[plugid];
|
||||
*(void **)&_output.Close=p_output_Close[plugid];
|
||||
*(void **)&_output.Flush=p_output_Flush[plugid];
|
||||
*(void **)&_output.GetOutputTime=p_output_GetOutputTime[plugid];
|
||||
*(void **)&_output.GetWrittenTime=p_output_GetWrittenTime[plugid];
|
||||
*(void **)&_output.IsPlaying=p_output_IsPlaying[plugid];
|
||||
*(void **)&_output.Open=p_output_Open[plugid];
|
||||
*(void **)&_output.Pause=p_output_Pause[plugid];
|
||||
*(void **)&_output.SetPan=p_output_SetPan[plugid];
|
||||
*(void **)&_output.SetVolume=p_output_SetVolume[plugid];
|
||||
*(void **)&_output.Write=p_output_Write[plugid];
|
||||
_output.hDllInstance=GetModuleHandle(0);
|
||||
_output.hMainWindow=0;
|
||||
_output.description="Emulated output device";
|
||||
_output.version=0x100;
|
||||
_output.id=999999999;
|
||||
}
|
||||
}
|
||||
if (_ioutput!=0) _ioutput->Release();
|
||||
_ioutput=o;
|
||||
if (o) o->AddRef();
|
||||
return errOk;
|
||||
}
|
||||
|
||||
#define WM_WA_MPEG_EOF WM_USER+2
|
||||
#define IPC_GET_API_SERVICE 3025
|
||||
|
||||
|
||||
static LRESULT NotifyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_WA_MPEG_EOF:
|
||||
{
|
||||
WAInputPlugin *o=(WAInputPlugin *)GetWindowLong(hWnd,GWL_USERDATA);
|
||||
if (o) o->MarkFinished();
|
||||
return 0;
|
||||
}
|
||||
case WM_USER:
|
||||
{
|
||||
switch (lParam)
|
||||
{
|
||||
case IPC_GETINIFILE:
|
||||
{
|
||||
return (LRESULT)("skeldalmusic.ini");
|
||||
}
|
||||
case IPC_GETINIDIRECTORY:
|
||||
{
|
||||
return (LRESULT)(".\\");
|
||||
}
|
||||
case IPC_GET_API_SERVICE: return 0;
|
||||
case IPC_GET_RANDFUNC: return (LRESULT)&rand;
|
||||
}
|
||||
}
|
||||
default: return DefWindowProc(hWnd,msg,wParam,lParam);
|
||||
}
|
||||
}
|
||||
|
||||
static const char *RegisterWAPluginWnd()
|
||||
{
|
||||
const char *name="WAPluginWnd";
|
||||
WNDCLASS cls;
|
||||
if (GetClassInfo(GetModuleHandle(0),name,&cls)==FALSE)
|
||||
{
|
||||
memset(&cls,0,sizeof(cls));
|
||||
cls.lpszClassName=name;
|
||||
cls.hInstance=GetModuleHandle(0);
|
||||
cls.lpfnWndProc=(WNDPROC)NotifyWndProc;
|
||||
RegisterClass(&cls);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
WAInputPlugin::PluginError WAInputPlugin::LoadPlugin(const char *name)
|
||||
{
|
||||
UnloadPlugin();
|
||||
char *cwd=_getcwd(0,0);
|
||||
char *setcwd=strcpy((char *)alloca(strlen(name)+1),name);
|
||||
char *bs=const_cast<char *>(strrchr(setcwd,'\\'));
|
||||
if (bs)
|
||||
{
|
||||
*bs=0;
|
||||
bs=const_cast<char *>(strrchr(setcwd,'\\'));
|
||||
if (bs) *bs=0;
|
||||
}
|
||||
_chdir(setcwd);
|
||||
SetErrorMode(SEM_FAILCRITICALERRORS);
|
||||
_mod=LoadLibrary(name);
|
||||
_chdir(cwd);
|
||||
free(cwd);
|
||||
if (_mod==0) return errNotFound;
|
||||
type_winampGetInModule2 winampGetInModule2=(type_winampGetInModule2)GetProcAddress(_mod,"winampGetInModule2");
|
||||
if (winampGetInModule2==0) return errNotValidPlugin;
|
||||
_inPlugin=winampGetInModule2();
|
||||
if (_inPlugin==0) return errCantInit;
|
||||
_hNotify=CreateWindow(RegisterWAPluginWnd(),"",0,0,0,0,0,0,0,GetModuleHandle(0),0);
|
||||
SetWindowLong(_hNotify,GWL_USERDATA,(LONG)this);
|
||||
_inPlugin->hMainWindow=_hNotify;
|
||||
_inPlugin->hDllInstance=_mod;
|
||||
_inPlugin->SAVSAInit=empty_SAVSAInit;
|
||||
_inPlugin->SAVSADeInit=empty_SAVSADeInit;
|
||||
_inPlugin->SAAddPCMData=empty_SAAddPCMData;
|
||||
_inPlugin->SAGetMode=empty_SAGetMode;
|
||||
_inPlugin->SAAdd=empty_SAAdd;
|
||||
_inPlugin->VSAAddPCMData=empty_VSAAddPCMData;
|
||||
_inPlugin->VSAGetMode=empty_VSAGetMode;
|
||||
_inPlugin->VSAAdd=empty_VSAAdd;
|
||||
_inPlugin->VSASetInfo=empty_VSASetInfo;
|
||||
_inPlugin->dsp_isactive=empty_dsp_isactive;
|
||||
_inPlugin->dsp_dosamples=empty_dsp_dosamples;
|
||||
_inPlugin->SetInfo=empty_SetInfo;
|
||||
_inPlugin->outMod=0;
|
||||
__try
|
||||
{
|
||||
_inPlugin->Init();
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
__try
|
||||
{
|
||||
_inPlugin->Quit();
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
_mod=0; //Free library cannot be called, because plugin cannot be terminated... memory and resource leak
|
||||
}
|
||||
_inPlugin=0;
|
||||
return errGPF;
|
||||
}
|
||||
_inPlugin->outMod=&_output;
|
||||
return errOk;
|
||||
}
|
||||
|
||||
WAInputPlugin::PluginError WAInputPlugin::Play(const char *name)
|
||||
{
|
||||
if (_inPlugin==0) return errNotLoaded;
|
||||
_finished=false;
|
||||
int i=_inPlugin->Play(const_cast<char *>(name));
|
||||
if (i==0) return errOk;
|
||||
if (i==-1) return errFileNotFound;
|
||||
return errCantPlay;
|
||||
}
|
||||
|
||||
WAInputPlugin::PluginError WAInputPlugin::Pause()
|
||||
{
|
||||
if (_inPlugin==0) return errNotLoaded;
|
||||
_inPlugin->Pause();
|
||||
return errOk;
|
||||
}
|
||||
WAInputPlugin::PluginError WAInputPlugin::UnPause()
|
||||
{
|
||||
if (_inPlugin==0) return errNotLoaded;
|
||||
_inPlugin->UnPause();
|
||||
return errOk;
|
||||
|
||||
}
|
||||
|
||||
WAInputPlugin::PluginError WAInputPlugin::IsPaused()
|
||||
{
|
||||
if (_inPlugin==0) return errNotLoaded;
|
||||
if (_inPlugin->IsPaused()) return errOk;
|
||||
return errFalse;
|
||||
}
|
||||
|
||||
WAInputPlugin::PluginError WAInputPlugin::Stop()
|
||||
{
|
||||
if (_inPlugin==0) return errNotLoaded;
|
||||
_inPlugin->Pause();
|
||||
_inPlugin->UnPause();
|
||||
_inPlugin->Stop();
|
||||
return errOk;
|
||||
}
|
||||
|
||||
WAInputPlugin::PluginError WAInputPlugin::SetOutputTime(int t)
|
||||
{
|
||||
if (_inPlugin==0) return errNotLoaded;
|
||||
_inPlugin->SetOutputTime(t);
|
||||
return errOk;
|
||||
}
|
||||
|
||||
WAInputPlugin::PluginError WAInputPlugin::SetVolume(int volume)
|
||||
{
|
||||
if (_inPlugin==0) return errNotLoaded;
|
||||
_inPlugin->SetVolume(volume);
|
||||
return errOk;
|
||||
|
||||
}
|
||||
WAInputPlugin::PluginError WAInputPlugin::SetPan(int pan)
|
||||
{
|
||||
if (_inPlugin==0) return errNotLoaded;
|
||||
_inPlugin->SetPan(pan);
|
||||
return errOk;
|
||||
}
|
||||
|
||||
WAInputPlugin::PluginError WAInputPlugin::EQSet(int on, char data[10], int preamp)
|
||||
{
|
||||
if (_inPlugin==0) return errNotLoaded;
|
||||
_inPlugin->EQSet(on,data,preamp);
|
||||
return errOk;
|
||||
}
|
||||
|
||||
bool WAInputPlugin::IsFinished()
|
||||
{
|
||||
MSG msg;
|
||||
if (PeekMessage(&msg,_hNotify,WM_WA_MPEG_EOF,WM_WA_MPEG_EOF,PM_REMOVE))
|
||||
{
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
return _finished;
|
||||
}
|
130
Windows/WAInputPlugin.h
Normal file
130
Windows/WAInputPlugin.h
Normal file
|
@ -0,0 +1,130 @@
|
|||
// WAInputPlugin.h: interface for the WAInputPlugin class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_WAINPUTPLUGIN_H__C78D396A_67F6_473B_891C_D6D162312554__INCLUDED_)
|
||||
#define AFX_WAINPUTPLUGIN_H__C78D396A_67F6_473B_891C_D6D162312554__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "winamp/in2.h"
|
||||
|
||||
class IWAOutput
|
||||
{
|
||||
public:
|
||||
|
||||
// returns >=0 on success, <0 on failure
|
||||
// NOTENOTENOTE: bufferlenms and prebufferms are ignored in most if not all output plug-ins.
|
||||
// ... so don't expect the max latency returned to be what you asked for.
|
||||
// returns max latency in ms (0 for diskwriters, etc)
|
||||
// bufferlenms and prebufferms must be in ms. 0 to use defaults.
|
||||
// prebufferms must be <= bufferlenms
|
||||
virtual int Open(int samplerate, int numchannels, int bitspersamp, int bufferlenms, int prebufferms)=0;
|
||||
|
||||
// close the ol' output device.
|
||||
virtual void Close()=0;
|
||||
|
||||
// 0 on success. Len == bytes to write (<= 8192 always). buf is straight audio data.
|
||||
// 1 returns not able to write (yet). Non-blocking, always.
|
||||
virtual int Write(const char *buf, int len)=0;
|
||||
|
||||
// returns number of bytes possible to write at a given time.
|
||||
// Never will decrease unless you call Write (or Close, heh)
|
||||
virtual int CanWrite()=0;
|
||||
|
||||
// non0 if output is still going or if data in buffers waiting to be
|
||||
// written (i.e. closing while IsPlaying() returns 1 would truncate the song
|
||||
virtual int IsPlaying()=0;
|
||||
|
||||
// returns previous pause state
|
||||
virtual int Pause(int pause)=0;
|
||||
|
||||
// volume is 0-255
|
||||
virtual void SetVolume(int volume)=0;
|
||||
// pan is -128 to 128
|
||||
virtual void SetPan(int pan)=0;
|
||||
|
||||
// flushes buffers and restarts output at time t (in ms)
|
||||
// (used for seeking)
|
||||
virtual void Flush(int t)=0;
|
||||
|
||||
// returns played time in MS
|
||||
virtual int GetOutputTime()=0;
|
||||
|
||||
// returns time written in MS (used for synching up vis stuff)
|
||||
virtual int GetWrittenTime()=0;
|
||||
|
||||
virtual unsigned long AddRef()=0;
|
||||
|
||||
virtual unsigned long Release()=0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class WAInputPlugin
|
||||
{
|
||||
HMODULE _mod;
|
||||
In_Module *_inPlugin;
|
||||
Out_Module _output;
|
||||
IWAOutput *_ioutput;
|
||||
bool _finished;
|
||||
HWND _hNotify;
|
||||
WAInputPlugin &operator=(const WAInputPlugin &other);
|
||||
WAInputPlugin(const WAInputPlugin &other);
|
||||
public:
|
||||
enum PluginError
|
||||
{
|
||||
errOk=0,
|
||||
errNotFound,
|
||||
errCantInit,
|
||||
errNotValidPlugin,
|
||||
errNotLoaded,
|
||||
errBufferTooSmall,
|
||||
errPluginBufferOverrun,
|
||||
errUnknownFileFormat,
|
||||
errTooManyPlugins,
|
||||
errFileNotFound,
|
||||
errCantPlay,
|
||||
errFalse,
|
||||
errGPF
|
||||
};
|
||||
public:
|
||||
WAInputPlugin();
|
||||
virtual ~WAInputPlugin();
|
||||
|
||||
PluginError LoadPlugin(const char *name);
|
||||
PluginError UIConfig(HWND parentHwnd=0);
|
||||
PluginError UIAbout(HWND parentHwnd=0);
|
||||
PluginError UnloadPlugin();
|
||||
PluginError IsLoaded();
|
||||
const char *GetDescription();
|
||||
PluginError GetFileInfo(const char *filename, char *title, int title_size, int *len_in_ms);
|
||||
PluginError UIFileInfo(const char *filename, HWND parentHwnd=0);
|
||||
PluginError CanPlayFile(const char *filename);
|
||||
PluginError AttachOutput(IWAOutput *o);
|
||||
IWAOutput *GetAttachedOutput() {if (_ioutput) _ioutput->AddRef();return _ioutput;}
|
||||
IWAOutput *GetAttachedOutputNoAddRef() {return _ioutput;}
|
||||
PluginError Play(const char *name);
|
||||
PluginError Pause();
|
||||
PluginError UnPause();
|
||||
PluginError IsPaused();
|
||||
PluginError Stop();
|
||||
int GetLength()
|
||||
{if (_inPlugin) return _inPlugin->GetLength();return -1;}
|
||||
int GetOutputTime()
|
||||
{if (_inPlugin) return _inPlugin->GetOutputTime();return -1;}
|
||||
PluginError SetOutputTime(int t);
|
||||
PluginError SetVolume(int volume); // from 0 to 255.. usually just call outMod->SetVolume
|
||||
PluginError SetPan(int pan); // from -127 to 127.. usually just call outMod->SetPan
|
||||
|
||||
PluginError EQSet(int on, char data[10], int preamp); // 0-64 each, 31 is +0, 0 is +12, 63 is -12. Do nothing to ignore.
|
||||
bool IsFinished();
|
||||
bool IsUsesOutput() {return _inPlugin->UsesOutputPlug!=0;}
|
||||
|
||||
void MarkFinished() {_finished=true;}
|
||||
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_WAINPUTPLUGIN_H__C78D396A_67F6_473B_891C_D6D162312554__INCLUDED_)
|
74
Windows/WAPlayer.cpp
Normal file
74
Windows/WAPlayer.cpp
Normal file
|
@ -0,0 +1,74 @@
|
|||
#include "stdafx.h"
|
||||
#include ".\waplayer.h"
|
||||
#include <malloc.h>
|
||||
|
||||
WAPlayer::WAPlayer(void)
|
||||
{
|
||||
_pluginList=0;
|
||||
}
|
||||
|
||||
WAPlayer::~WAPlayer(void)
|
||||
{
|
||||
ClearList();
|
||||
}
|
||||
|
||||
|
||||
void WAPlayer::ClearList()
|
||||
{
|
||||
delete [] _pluginList;
|
||||
_pluginList=0;
|
||||
_nPlugins=0;
|
||||
}
|
||||
|
||||
void WAPlayer::LoadPlugins(const char *path)
|
||||
{
|
||||
char *wildcards=(char *)alloca(strlen(path)+10);
|
||||
char *pathname=(char *)alloca(strlen(path)+MAX_PATH);
|
||||
// CheckPathname(pathname);
|
||||
strcpy(wildcards,path);
|
||||
strcpy(pathname,path);
|
||||
if (wildcards[strlen(wildcards)-1]!='\\')
|
||||
{
|
||||
strcat(wildcards,"\\");
|
||||
strcat(pathname,"\\");
|
||||
}
|
||||
char *fname=strchr(pathname,0);
|
||||
strcat(wildcards,"in_*.dll");
|
||||
HANDLE h;
|
||||
ClearList();
|
||||
WIN32_FIND_DATA fnd;
|
||||
h=FindFirstFile(wildcards,&fnd);
|
||||
if (h) do
|
||||
{
|
||||
_nPlugins++;
|
||||
}while(FindNextFile(h,&fnd));
|
||||
FindClose(h);
|
||||
|
||||
_pluginList=new WAInputPlugin[_nPlugins];
|
||||
int pos=0;
|
||||
h=FindFirstFile(wildcards,&fnd);
|
||||
if (h != INVALID_HANDLE_VALUE) do
|
||||
{
|
||||
strcpy(fname,fnd.cFileName);
|
||||
if (_pluginList[pos].LoadPlugin(pathname)!=WAInputPlugin::errOk)
|
||||
_pluginList[pos].UnloadPlugin();
|
||||
else
|
||||
pos++;
|
||||
}
|
||||
while (FindNextFile(h,&fnd));
|
||||
_nPlugins=pos;
|
||||
FindClose(h);
|
||||
}
|
||||
|
||||
WAInputPlugin *WAPlayer::SelectBestPlugin(const char *songName)
|
||||
{
|
||||
for (int i=0;i<_nPlugins;i++)
|
||||
if (_pluginList[i].CanPlayFile(songName)==WAInputPlugin::errOk) return _pluginList+i;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool WAPlayer::EnumPlugins(bool (*EnumProc)(WAPlayer &player, WAInputPlugin &plugin, void *context), void *context)
|
||||
{
|
||||
for (int i=0;i<_nPlugins;i++) if (EnumProc(*this,_pluginList[i],context)==false) return false;
|
||||
return true;
|
||||
}
|
23
Windows/WAPlayer.h
Normal file
23
Windows/WAPlayer.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include "WAInputPlugin.h"
|
||||
|
||||
class WAPlayer
|
||||
{
|
||||
WAInputPlugin *_pluginList;
|
||||
int _nPlugins;
|
||||
|
||||
WAPlayer &operator=(const WAPlayer &other);
|
||||
WAPlayer(const WAPlayer &other);
|
||||
public:
|
||||
WAPlayer(void);
|
||||
~WAPlayer(void);
|
||||
|
||||
|
||||
|
||||
void ClearList();
|
||||
void LoadPlugins(const char *path);
|
||||
WAInputPlugin *SelectBestPlugin(const char *songName);
|
||||
|
||||
bool EnumPlugins(bool (*EnumProc)(WAPlayer &player, WAInputPlugin &plugin, void *context), void *context);
|
||||
};
|
157
Windows/WaveOut.cpp
Normal file
157
Windows/WaveOut.cpp
Normal file
|
@ -0,0 +1,157 @@
|
|||
// WaveOut.cpp: implementation of the WaveOut class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "WaveOut.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
WaveOut::WaveOut()
|
||||
{
|
||||
_device=0;
|
||||
}
|
||||
|
||||
WaveOut::~WaveOut()
|
||||
{
|
||||
if (_device) Close();
|
||||
}
|
||||
|
||||
|
||||
int WaveOut::Open(int samplerate, int numchannels, int bitspersamp, int bufferlenms, int prebufferms)
|
||||
{
|
||||
MSG msg;
|
||||
PeekMessage(&msg,0,0,0,0); //ensure message queue created
|
||||
_paused=false;
|
||||
_wrpos=0;
|
||||
_pending=0;
|
||||
memset(_buffers,0,sizeof(_buffers));
|
||||
_played=0;
|
||||
_written=0;
|
||||
|
||||
WAVEFORMATEX format;
|
||||
format.cbSize=sizeof(format);
|
||||
format.nChannels=numchannels;
|
||||
format.nSamplesPerSec=samplerate;
|
||||
format.nAvgBytesPerSec=numchannels*samplerate*(bitspersamp/8);
|
||||
format.nBlockAlign=numchannels*(bitspersamp/8);
|
||||
format.wBitsPerSample=bitspersamp;
|
||||
format.wFormatTag=WAVE_FORMAT_PCM;
|
||||
_event=CreateEvent(NULL,FALSE,FALSE,NULL);
|
||||
_persec=format.nAvgBytesPerSec;
|
||||
MMRESULT res=waveOutOpen(&_device,WAVE_MAPPER,&format,(DWORD)_event,(DWORD)this,CALLBACK_EVENT);
|
||||
if (res==MMSYSERR_NOERROR) return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void WaveOut::Close()
|
||||
{
|
||||
Flush(1);
|
||||
waveOutClose(_device);
|
||||
_device=0;
|
||||
|
||||
}
|
||||
|
||||
int WaveOut::NextBuffer()
|
||||
{
|
||||
int b=_wrpos;
|
||||
printf("Buffers: %5d time: %d\r",_pending,GetOutputTime()/1000);
|
||||
if (_buffers[_wrpos]==0 || (_buffers[_wrpos]->dwFlags & WHDR_DONE))
|
||||
{
|
||||
if (_buffers[_wrpos])
|
||||
{
|
||||
waveOutUnprepareHeader(_device,_buffers[_wrpos],sizeof(*_buffers[_wrpos]));
|
||||
free(_buffers[_wrpos]->lpData);
|
||||
_played+=_buffers[_wrpos]->dwBufferLength;
|
||||
delete _buffers[_wrpos];
|
||||
_buffers[_wrpos]=0;
|
||||
_pending--;
|
||||
}
|
||||
_wrpos++;
|
||||
if (_wrpos>=MAXBUFFERS) _wrpos=0;
|
||||
return b;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int WaveOut::Write(const char *buf, int len)
|
||||
{
|
||||
int pos=NextBuffer();
|
||||
while (pos==-1)
|
||||
{
|
||||
WaitForSingleObject(_event,INFINITE);
|
||||
pos=NextBuffer();
|
||||
}
|
||||
WAVEHDR *hdr=new WAVEHDR;
|
||||
memset(hdr,0,sizeof(*hdr));
|
||||
hdr->dwBufferLength=len;
|
||||
hdr->lpData=(char *)malloc(len);
|
||||
memcpy(hdr->lpData,buf,len);
|
||||
waveOutPrepareHeader(_device,hdr,sizeof(*hdr));
|
||||
waveOutWrite(_device,hdr,sizeof(*hdr));
|
||||
_buffers[pos]=hdr;
|
||||
_pending++;
|
||||
_written+=len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int WaveOut::CanWrite()
|
||||
{
|
||||
return _paused?0:16*1024*1024;
|
||||
}
|
||||
|
||||
int WaveOut::IsPlaying()
|
||||
{
|
||||
while (_pending)
|
||||
{
|
||||
if (NextBuffer()==-1) return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int WaveOut::Pause(int pause)
|
||||
{
|
||||
bool waspaused=_paused;
|
||||
if (pause)
|
||||
{
|
||||
if (!waspaused) waveOutPause(_device);
|
||||
_paused=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (waspaused) waveOutRestart(_device);
|
||||
_paused=false;
|
||||
}
|
||||
return waspaused?1:0;
|
||||
}
|
||||
|
||||
void WaveOut::SetVolume(int volume)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void WaveOut::SetPan(int pan)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void WaveOut::Flush(int t)
|
||||
{
|
||||
waveOutReset(_device);
|
||||
while (_pending) NextBuffer();
|
||||
}
|
||||
|
||||
|
||||
int WaveOut::GetOutputTime()
|
||||
{
|
||||
return (int)((__int64)_played*(__int64)1000/(__int64)_persec);
|
||||
}
|
||||
|
||||
int WaveOut::GetWrittenTime()
|
||||
{
|
||||
return (int)((__int64)_played*(__int64)1000/(__int64)_persec);
|
||||
}
|
52
Windows/WaveOut.h
Normal file
52
Windows/WaveOut.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
// WaveOut.h: interface for the WaveOut class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_WAVEOUT_H__1390C856_FA5C_4E84_B98D_4CC05086733D__INCLUDED_)
|
||||
#define AFX_WAVEOUT_H__1390C856_FA5C_4E84_B98D_4CC05086733D__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#define MAXBUFFERS 64
|
||||
|
||||
#include "WAInputPlugin.h"
|
||||
#include <mmsystem.h>
|
||||
|
||||
class WaveOut: public IWAOutput
|
||||
{
|
||||
HWAVEOUT _device;
|
||||
bool _paused;
|
||||
LPWAVEHDR _buffers[MAXBUFFERS];
|
||||
int _wrpos;
|
||||
HANDLE _event;
|
||||
DWORD _played;
|
||||
DWORD _written;
|
||||
DWORD _persec;
|
||||
|
||||
int NextBuffer();
|
||||
int _pending;
|
||||
|
||||
public:
|
||||
WaveOut();
|
||||
virtual ~WaveOut();
|
||||
|
||||
virtual int Open(int samplerate, int numchannels, int bitspersamp, int bufferlenms, int prebufferms);
|
||||
virtual void Close();
|
||||
virtual int Write(const char *buf, int len);
|
||||
virtual int CanWrite();
|
||||
virtual int IsPlaying();
|
||||
virtual int Pause(int pause);
|
||||
virtual void SetVolume(int volume);
|
||||
virtual void SetPan(int pan);
|
||||
virtual void Flush(int t);
|
||||
virtual int GetOutputTime();
|
||||
virtual int GetWrittenTime();
|
||||
virtual unsigned long AddRef() {return 1;}
|
||||
virtual unsigned long Release() {return 0;}
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // !defined(AFX_WAVEOUT_H__1390C856_FA5C_4E84_B98D_4CC05086733D__INCLUDED_)
|
27
Windows/WinAmpInterface.cpp
Normal file
27
Windows/WinAmpInterface.cpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
// WinAmpInterface.cpp : Defines the entry point for the console application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "WAInputPlugin.h"
|
||||
#include "WaveOut.h"
|
||||
#include "waplayer.h"
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
WAPlayer player;
|
||||
player.LoadPlugins("C:\\Program Files\\Winamp\\Plugins");
|
||||
const char *name="\\\\bredy-doma\\d$\\MUSIC\\S3M\\s3m\\CTGOBLIN.S3M";
|
||||
WAInputPlugin *plug=player.SelectBestPlugin(name);
|
||||
|
||||
WaveOut output;
|
||||
plug->AttachOutput(&output);
|
||||
plug->Play(name);
|
||||
while (kbhit()==0 && !plug->IsFinished()) Sleep(500);
|
||||
plug->Stop();
|
||||
plug->AttachOutput(0);
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
0
Windows/WinAmpInterface.h
Normal file
0
Windows/WinAmpInterface.h
Normal file
0
Windows/bios.c
Normal file
0
Windows/bios.c
Normal file
2
Windows/bios.h
Normal file
2
Windows/bios.h
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include <windows.h>
|
||||
|
19
Windows/debug.h
Normal file
19
Windows/debug.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
#ifndef _DEBUG_H_
|
||||
#define _DEBUG_H_
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define STOP() StopProgram(__FILE__,__LINE__);
|
||||
|
||||
static __inline void StopProgram(const char *text, int line)
|
||||
{
|
||||
char buff[256];
|
||||
sprintf(buff,"Stop at %s line %d",text,line);
|
||||
MessageBox(NULL,buff,NULL,MB_OK|MB_SYSTEMMODAL);
|
||||
__asm
|
||||
{
|
||||
int 3;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
77
Windows/extras.rtf
Normal file
77
Windows/extras.rtf
Normal file
|
@ -0,0 +1,77 @@
|
|||
{\rtf1\ansi\deff1\adeflang1025
|
||||
{\fonttbl{\f0\froman\fprq2\fcharset238 Times New Roman;}{\f1\froman\fprq2\fcharset238 Thorndale{\*\falt Times New Roman};}{\f2\froman\fprq2\fcharset238 Times New Roman;}{\f3\froman\fprq2\fcharset238 Thorndale{\*\falt Times New Roman};}{\f4\fnil\fprq0\fcharset238 Times New Roman;}{\f5\fnil\fprq0\fcharset2 StarSymbol;}{\f6\fmodern\fprq1\fcharset238 Courier New;}{\f7\fnil\fprq2\fcharset238 Lucida Sans Unicode;}{\f8\fnil\fprq2\fcharset238 Tahoma;}{\f9\fnil\fprq0\fcharset238 Tahoma;}}
|
||||
{\colortbl;\red0\green0\blue0;\red128\green128\blue128;}
|
||||
{\stylesheet{\s1\cf1{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f1\fs24\lang1029\snext1 Default;}
|
||||
{\s2\sa120\cf1{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f1\fs20\lang1029\sbasedon1\snext2 Text body;}
|
||||
{\s3\li283\ri0\lin283\rin0\fi283\cf1\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f2\fs20\lang1029\sbasedon2\snext3 Text body indent;}
|
||||
{\s4\sb240\sa120\keepn\cf1{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\ql\rtlch\af8\afs28\lang255\ltrch\dbch\af7\afs28\langfe255\loch\f4\fs28\lang1029\sbasedon1\snext2 Heading;}
|
||||
{\s5\cf1\uldb{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\ql\rtlch\af1\afs32\lang255\ab\ltrch\dbch\af1\afs32\langfe255\ab\loch\f1\fs32\lang1029\b\sbasedon4\snext2{\*\soutlvl0} Heading 1;}
|
||||
{\s6\cf1\shad\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af1\afs28\lang255\ai\ab\ltrch\dbch\af1\afs28\langfe255\ai\ab\loch\f1\fs24\lang1029\i\b\sbasedon4\snext2{\*\soutlvl1} Heading 2;}
|
||||
{\s7\cf1{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\ql\rtlch\af9\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f1\fs24\lang1029\sbasedon2\snext7 List;}
|
||||
{\s8\sb120\sa120\cf1{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\ql\rtlch\af9\afs20\lang255\ai\ltrch\dbch\af1\afs20\langfe255\ai\loch\f1\fs20\lang1029\i\sbasedon1\snext8 Caption;}
|
||||
{\s9\cf1{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\ql\rtlch\af9\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f1\fs24\lang1029\sbasedon1\snext9 Index;}
|
||||
{\*\cs11\cf1\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f1\fs24\lang1029 Drop Caps;}
|
||||
{\*\cs12\cf1\rtlch\af5\afs18\lang255\ltrch\dbch\af5\afs18\langfe255\loch\f5\fs18\lang1029 Bullets;}
|
||||
{\*\cs13\cf1\horzvert0\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f1\fs24\lang1029 Vertical Numbering Symbols;}
|
||||
{\*\cs14\cf1\rtlch\af6\afs24\lang255\ltrch\dbch\af6\afs24\langfe255\loch\f6\fs24\lang1029 Example;}
|
||||
{\*\cs15\cf1\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f1\fs24\lang1029 Definition;}
|
||||
{\*\cs16\cf1\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f1\fs24\lang1029 Numbering Symbols;}
|
||||
}{\*\listtable{\list\listtemplateid1
|
||||
{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow2{\leveltext \'02\'00.;}{\levelnumbers\'01;}\fi-283\li283}
|
||||
{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow2{\leveltext \'02\'01);}{\levelnumbers\'01;}\fi-283\li567}\listid1}
|
||||
}{\listoverridetable{\listoverride\listid1\listoverridecount0\ls0}}
|
||||
|
||||
{\info{\creatim\yr2004\mo4\dy25\hr23\min7}{\operator Ondrej Novak}{\revtim\yr2004\mo4\dy26\hr22\min53}{\printim\yr1601\mo1\dy1\hr0\min0}{\comment StarWriter}{\vern6450}}\deftab1134
|
||||
{\*\pgdsctbl
|
||||
{\pgdsc0\pgdscuse195\pgwsxn12240\pghsxn15840\marglsxn1800\margrsxn1800\margtsxn1440\margbsxn1440\pgdscnxt0 Default;}}
|
||||
{\*\pgdscno0}\paperh15840\paperw12240\margl1800\margr1800\margt1440\margb1440\sectd\sbknone\pgwsxn12240\pghsxn15840\marglsxn1800\margrsxn1800\margtsxn1440\margbsxn1440\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc
|
||||
\pard\plain \sb240\sa120\keepn\f4\fs32\uldb\b\f7\fs32\b\f8\fs32\b \ltrpar\s5\cf1\uldb{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\ql\rtlch\af1\afs32\lang255\ab\ltrch\dbch\af1\afs32\langfe255\ab\loch\f1\fs32\lang1029\b {\loch\f4\fs32\lang1029\i0\b Popis nov\'fdch roz\'9a\'ed\u345 ?en\'ed ve Skeldalu}
|
||||
\par \pard\plain \ltrpar\s2\cf1{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\sa120\ql\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f1\fs20\lang1029 {\loch\f1\fs20\lang1029\i0\b0 Oproti p\u367 ?vodn\'ed DOS verzi obsahuje verze pro Windows n\u283 ?kter\'e1 vylep\'9aen\'ed. Ka\'9ed\'e9 vylep\'9aen\'ed je v\'9aak nutn\'e9 aktivovat zatrhnut\'edm p\u345 ?\'edslu\'9an\'e9ho ok\'e9nka.}
|
||||
\par \pard\plain \sb240\sa120\keepn\f4\i\shad\b\f7\fs28\i\b\f8\fs28\i\b\qj \ltrpar\s6\cf1\shad\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af1\afs28\lang255\ai\ab\ltrch\dbch\af1\afs28\langfe255\ai\ab\loch\f1\fs24\lang1029\i\b {\loch\f4\fs24\lang1029\i\b N\'e1hodn\'fd backfire (p\u345 ?i kouzlen\'ed) }
|
||||
\par \pard\plain \ltrpar\s3\cf1\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\li283\ri0\lin283\rin0\fi283\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f2\fs20\lang1029{\loch\f2\fs20\lang1029\i0\b{\b Backfire }}{\loch\f2\fs20\lang1029znamen\'e1 v p\u345 ?ekladu {\i "Zp\u283 ?tn\'fd n\'e1raz"}. To nast\'e1v\'e1 v situaci, kdy se \u269 ?arod\u283 ?ji kouzlo nezda\u345 ?\'ed, av\'9aak nav\'edc m\'e1 tu sm\u367 ?lu, \'9ee jeho ne\'fasp\u283 ?ch je tak fat\'e1ln\'ed, \'9ee se kouzlo obr\'e1t\'ed proti n\u283 ?mu. Pokud je za\'9akrtnuta volba {\b N\'e1hodn\'fd backfire}, m\u367 ?\'9ee \u269 ?arod\u283 ?j p\u345 ?i fat\'e1ln\'ed
|
||||
m ne\'fasp\u283 ?chu necht\u283 ?n\u283 ? vyvolat n\'e1hodn\u283 ? kter\'e9koliv kouzlo z cel\'e9ho souboru kouzel Skeldalu (jde jen o kouzla z run), takto m\u367 ?\'9ee vyvolat i kouzlo, na kter\'e9 nem\'e1, ani nem\u367 ?\'9ee m\'edt \'farve\u328 ?, nebo nem\'e1 manu. Mana se p\u345 ?itom spot\u345 ?ebuje jen tolik, kolik by se spot\u345 ?eboval
|
||||
o na kouzlo, jen\'9e cht\u283 ?l vyvolat. }
|
||||
\par {\loch\f2\fs20\lang1029\i0\b0 Plat\'ed zde n\u283 ?kolik pravidel. Pokud je to kouzlo na postavu, automaticky se vybere \u269 ?arod\u283 ?j. Pokud m\'e1 kouzlo \'fa\u269 ?inkovat na pol\'ed\u269 ?ko, m\'e1 vliv na v\'9aechny postavy na pol\'ed\u269 ?ku, kde stoj\'ed \u269 ?arod\u283 ?j. Pokud m\'e1 kouzlo \'fa\u269 ?inkovat na pol\'ed\u269 ?ku p\u345 ?ed \u269 ?arod\u283 ?jem, m\'e1 vliv na v\'9aechn
|
||||
y postavy na pol\'ed\u269 ?ku, kde stoj\'ed \u269 ?arod\u283 ?j. V p\u345 ?\'edpad\u283 ?, \'9ee se jedn\'e1 o kouzlo teleportace, je zvolen n\'e1hodn\'fd c\'edl v r\'e1mci cel\'e9ho bludi\'9at\u283 ?. }
|
||||
\par {\loch\f2\fs20\lang1029\i0\b0 Za\'9akrtnut\'ed t\'e9to volby m\u367 ?\'9ee zp\u283 ?st\u345 ?it hru p\u345 ?i souboj\'edch s nep\u345 ?\'edli\'9a vy\'9akolen\'fdmi \u269 ?arod\u283 ?ji. \u268 ?asto m\u367 ?\'9ee tento necht\u283 ?n\'fd backfire p\u345 ?\'edn\'e9st i n\u283 ?jakou v\'fdhodu. }
|
||||
\par \pard\plain \sb240\sa120\keepn\f4\i\shad\b\f7\fs28\i\b\f8\fs28\i\b\qj \ltrpar\s6\cf1\shad\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af1\afs28\lang255\ai\ab\ltrch\dbch\af1\afs28\langfe255\ai\ab\loch\f1\fs24\lang1029\i\b {\loch\f4\fs24\lang1029\i\b Recykluj nestv\u367 ?ry }
|
||||
\par \pard\plain \ltrpar\s3\cf1\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\li283\ri0\lin283\rin0\fi283\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f2\fs20\lang1029 {\loch\f2\fs20\lang1029\i0\b0 Zap\'edn\'e1 obnovov\'e1n\'ed nestv\u367 ?r. Pro hr\'e1\u269 ?e, jen\'9e maj\'ed pocit, \'9ee vybit\'e9 prostory jsou p\u345 ?\'edli\'9a nudn\'e9 je mo\'9en\'e9 tuto volbu aktivovat. Pot\'e9 se p\u345 ?esto v m\'edstech, kde byly nestvury pobity \u269 ?asem n\u283 ?jak\'e1 nestv\u367 ?ra znova objev\'ed. Nastaven\'ed neovlivn\'ed ty nestv\u367 ?ry, jen\'9e maj\'ed obn
|
||||
ovov\'e1n\'ed povolen\'e9 v dobrodru\'9estv\'ed (ty se obnovuj\'ed st\'e1le) }
|
||||
\par \pard\plain \sb240\sa120\keepn\f4\i\shad\b\f7\fs28\i\b\f8\fs28\i\b\qj \ltrpar\s6\cf1\shad\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af1\afs28\lang255\ai\ab\ltrch\dbch\af1\afs28\langfe255\ai\ab\loch\f1\fs24\lang1029\i\b {\loch\f4\fs24\lang1029\i\b Alternativn\'ed bojov\'fd syst\'e9m}
|
||||
\par \pard\plain \ltrpar\s3\cf1\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\li283\ri0\lin283\rin0\fi283\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f2\fs20\lang1029 {\loch\f2\fs20\lang1029\i0\b0 Br\'e1ny Skeldalu pro Windows p\u345 ?in\'e1\'9aej\'ed pozm\u283 ?n\u283 ?n\'fd bojov\'fd system. Jde zejm\'e9na o nov\'e9 v\'fdpo\u269 ?ty a vzorce pro z\'e1sah. P\u367 ?vodn\'ed bojov\'fd syst\'e9m pouze p\u345 ?i\u269 ?\'edt\'e1 k s\'edle \'fato\u269 ?n\'e9 \u269 ?\'edslo, obratnosti obran\'e9 \u269 ?\'edslo, porovn\'e1v\'e1 je a z toho se vypo\u269 ?\'edt\'e1 z\'e1sah. Alternativn\'ed bojov\'fd syst
|
||||
\'e9m m\'e1 v\'edc n\'e1hodn\'fdch \u269 ?\'e1st\'ed, ale p\u345 ?esto d\'e1v\'e1 v\u283 ?t\'9a\'ed d\u367 ?raz i na vlastnosti postav. }
|
||||
\par {\loch\f2\fs20\lang1029\i0\b0 \'dato\u269 ?n\'e1 a obrann\'e1 \u269 ?\'edsla se po\u269 ?\'edtaj\'ed 2x. Ve vzorc\'edch parametr chaos ud\'e1v\'e1 postih za p\u345 ?\'edli\'9a mnoho postav na pol\'ed\u269 ?ku a po\u269 ?\'edt\'e1 se jako chaos=(po\u269 ?et_postav+1)/2 /v\u269 ?etn\u283 ? sama sebe/.}
|
||||
\par \pard\plain {\listtext\pard\plain \li850\ri0\lin850\rin0\fi-283\sa120\f2\fs20\qj 1)}\ilvl1 \ltrpar\s3\cf1\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\ls0\li850\ri0\lin850\rin0\fi-283\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f2\fs20\lang1029 {\loch\f2\fs20\lang1029\i0\b0 Prvn\'ed v\'fdpo\u269 ?et spo\u269 ?\'edt\'e1 \'fato\u269 ?n\'e9 \u269 ?\'edslo (\'fa\u269 ?) a obrann\'e9 \u269 ?\'edslo (o\u269 ?) takto:}
|
||||
\par \pard\plain \ltrpar\s3\cf1\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\li850\ri0\lin850\rin0\fi283\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f2\fs20\lang1029{\loch\f6\fs16\lang1029\i0\b0{\fs16\f6 \'fa\u269 ?=n\'e1hoda(\'fatok_min,\'fatok_max)+\'fato\u269 ?n\'edk.obratnost/4\line o\u269 ?=n\'e1hoda(obrana_min,obrana_max)+obr\'e1nce.obratnost/(4*chaos)}}{\loch\f2\fs20\lang1029\line \line pokud o\u269 ?>\'fa\u269 ?, pak se obr\'e1nce \'fabr\'e1n\'edl \'fatoku (me\u269 ?em, \'9at\'edtem, usko\u269 ?il, nastavil bezpe\u269 ?nou \u269 ?\'e1st brn\u283 ?n\'ed) a nem\u367 ?\'9ee b\'fdt zasa\'9een b\u283 ?\'9en\'fdm \'fatokem}
|
||||
\par \pard\plain {\listtext\pard\plain \li850\ri0\lin850\rin0\fi-283\sa120\f2\fs20\qj 2)}\ilvl1 \ltrpar\s3\cf1\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\ls0\li850\ri0\lin850\rin0\fi-283\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f2\fs20\lang1029 {\loch\f2\fs20\lang1029\i0\b0 Druh\'fd v\'fdpo\u269 ?et spo\u269 ?\'edt\'e1 druh\'e9 \'fato\u345 ?n\'e9 \u269 ?\'edslo (\'fa\u269 ?2) a druh\'e9 obrann\'e9 \u269 ?\'edslo (o\u269 ?2)}
|
||||
\par \pard\plain \ltrpar\s3\cf1\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\li850\ri0\lin850\rin0\fi283\rtlch\af1\afs16\lang255\ltrch\dbch\af1\afs16\langfe255\loch\f6\fs16\lang1029 {\loch\f6\fs16\lang1029\i0\b0 \'fa\u269 ?2=n\'e1hoda(\'fatok_min,\'fatok_max)+\'fato\u269 ?n\'edk.s\'edla/5\line o\u269 ?2=n\'e1hoda(obrana_min,obrana_max)+obr\'e1nce.obratnost/(5*chaos)}
|
||||
\par \pard\plain \ltrpar\s3\cf1\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\li850\ri0\lin850\rin0\fi283\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f2\fs20\lang1029 {\loch\f2\fs20\lang1029\i0\b0 pokud o\u269 ?>\'fa\u269 ?, pak z\'e1sah padnul na brn\u283 ?n\'ed a nezp\u367 ?sobilo \'9e\'e1dn\'e9 po\'9akozen\'ed\line pokud \'fa\u269 ?<o\u269 ?, pak byl obr\'e1nce zasa\'9een o rozd\'edl obou \u269 ?\'edsel. K rozd\'edlu se je\'9at\u283 ? p\u345 ?ipo\u269 ?\'edt\'e1 \'fa\u269 ?innost zbran\u283 ? (u ne\'fa\u269 ?inn\'fdch zbran\'ed) a pokud z\'e1sah je z\'e1porn\'fd, uva\'9euje se 1.}
|
||||
\par \pard\plain {\listtext\pard\plain \li850\ri0\lin850\rin0\fi-283\sa120\f2\fs20\qj 3)}\ilvl1 \ltrpar\s3\cf1\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\ls0\li850\ri0\lin850\rin0\fi-283\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f2\fs20\lang1029 {\loch\f2\fs20\lang1029\i0\b0 Magick\'fd \'fatok se po\u269 ?\'edt\'e1 stejn\u283 ? jako v p\u367 ?vodn\'ed verzi. Rozd\'edl je pouze v p\u345 ?\'edpad\u283 ?, \'9ee zran\u283 ?n\'ed magi\'ed je men\'9a\'ed, ne\'9e polovina hodnoty ochrany. V tom p\u345 ?\'edpad\u283 ? plat\'ed, \'9ee \u269 ?\'edm men\'9a\'ed je zran\u283 ?n\'ed, t\'edm je v\u283 ?t\'9a\'ed pravd\u283 ?podobnost, \'9ee se magick\'fd \'fatok rozpt\'fdl\'ed \'fapln\u283 ?. Nap\u345 ?\'edklad
|
||||
p\u345 ?i ochran\u283 ? 60% je 50% \'9aance, \'9ee magick\'fd \'fatok 15 se vst\u345 ?eb\'e1 \'fapln\u283 ? a nezp\u367 ?sob\'ed \'9e\'e1dn\'e9 zran\u283 ?n\'ed.}
|
||||
\par \pard\plain \ltrpar\s3\cf1\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\li567\ri0\lin567\rin0\fi283\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f2\fs20\lang1029 {\loch\f2\fs20\lang1029\i0\b0 Tento bojov\'fd syst\'e9m je v\'edc p\u345 ?irozen\'fd. Je v\'edc pravd\u283 ?podobn\u283 ?j\'9a\'ed, \'9ee souboj rovnocen\'fdch sok\u367 ? bude \u269 ?asto dopadat tak, \'9ee se \'fatokem nezran\'ed, \u269 ?ili nen\'ed to jen o po\u269 ?tu \'9eivot\u367 ?, \u269 ?\'edm v\'edc t\'edm l\'edp. Do boje se zapojuj\'ed v\'9aechny bojov\'e9 vlastnosti, obratnost a s\'edla.}
|
||||
\par \pard\plain \sb240\sa120\keepn\f4\i\shad\b\f7\fs28\i\b\f8\fs28\i\b\qj \ltrpar\s6\cf1\shad\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af1\afs28\lang255\ai\ab\ltrch\dbch\af1\afs28\langfe255\ai\ab\loch\f1\fs24\lang1029\i\b {\loch\f4\fs24\lang1029\i\b Vracej do hry zni\u269 ?en\'e9 nebo utopen\'e9 p\u345 ?edm\u283 ?ty }
|
||||
\par \pard\plain \ltrpar\s3\cf1\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\li283\ri0\lin283\rin0\fi283\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f2\fs20\lang1029 {\loch\f2\fs20\lang1029\i0\b0 Pokud je volba aktivov\'e1na, Skeldal p\u345 ?i ka\'9ed\'e9m zni\u269 ?en\'ed, nebo utopen\'ed p\u345 ?edm\u283 ?tu vlo\'9e\'ed do mapy na n\'e1hodn\'e9 m\'edsto kopii p\u345 ?edm\u283 ?tu. Takto lze sn\'ed\'9eit riziko, \'9ee bude zni\u269 ?en d\u367 ?le\'9eit\'fd jedine\u269 ?n\'fd p\u345 ?edm\u283 ?t. P\u345 ?edm\u283 ?ty jsou rozm\'ed\u357 ?ov\'e1ny tak, aby je hr\'e1\u269 ? mohl naj\'edt, av\'9aak n\u283 ?k
|
||||
ter\'e9 bludi\'9at\u283 ? mohou m\'edt speci\'e1ln\'ed akce a t\'edm hled\'e1n\'ed p\u345 ?edm\u283 ?tu st\'ed\'9eit. }
|
||||
\par \pard\plain \sb240\sa120\keepn\f4\i\shad\b\f7\fs28\i\b\f8\fs28\i\b\qj \ltrpar\s6\cf1\shad\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af1\afs28\lang255\ai\ab\ltrch\dbch\af1\afs28\langfe255\ai\ab\loch\f1\fs24\lang1029\i\b {\loch\f4\fs24\lang1029\i\b Vlo\'9e\'ed p\u345 ?edm\u283 ?ty ze zem\u283 ? do batohu pomoc\'ed CTRL }
|
||||
\par \pard\plain \ltrpar\s3\cf1\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\li283\ri0\lin283\rin0\fi283\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f2\fs20\lang1029 {\loch\f2\fs20\lang1029\i0\b0 Pokud je volba aktivov\'e1na, lze vz\'edt do my\'9a\'edho kurzoru zavazadlo a za sou\u269 ?asn\'e9ho dr\'9een\'ed tla\u269 ?\'edtka Control (CTRL), klik\'e1n\'edm posb\'edrat le\'9e\'edc\'ed p\u345 ?edm\u283 ?ty p\u345 ?\'edmo do zavazadla. P\u345 ?i sb\'edr\'e1n\'ed se v\'9edy sebere cel\'e1 hrom\'e1dka, (pokud nen\'ed p\u345 ?ekro\u269 ?ena nosnost zavazdla), s t\'edm,
|
||||
\'9ee se vykonaj\'ed funkce speci\'e1ln\'edch p\u345 ?edm\u283 ?t\u367 ? (mince se zapo\u269 ?\'edtaji do pen\u283 ?z, svitek se p\u345 ?ep\'ed\'9ae do knihy, runa se ulo\'9e\'ed do panelu run). }
|
||||
\par \pard\plain \sb240\sa120\keepn\f4\i\shad\b\f7\fs28\i\b\f8\fs28\i\b\qj \ltrpar\s6\cf1\shad\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af1\afs28\lang255\ai\ab\ltrch\dbch\af1\afs28\langfe255\ai\ab\loch\f1\fs24\lang1029\i\b {\loch\f4\fs24\lang1029\i\b Lep\'9a\'ed v\'fdhody \'9at\'edt\u367 ? p\u345 ?i souboj\'edch }
|
||||
\par \pard\plain \ltrpar\s3\cf1\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\li283\ri0\lin283\rin0\fi283\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f2\fs20\lang1029 {\loch\f2\fs20\lang1029\i0\b0 V p\u345 ?\'edpad\u283 ?, \'9ee postava m\'e1 \'9at\'edt a hodn\u283 ? vitality, zapo\u269 ?\'edt\'e1v\'e1 se j\'ed do obran\'e9ho \u269 ?\'edsla \'9at\'edt 2x. Pokud m\'e1 v\'9aak m\'e1lo vitality, \'9at\'edt je ji\'9e sp\'ed\'9a na obt\'ed\'9e a proto se naopak nezapo\u269 ?\'edt\'e1v\'e1 v\u367 ?bec. Tato volba z\'e1rove\u328 ? deaktivuje minim\'e1ln\'ed hodnotu vitality, kdy se postav
|
||||
a je\'9at\u283 ? br\'e1n\'ed, tak\'9ee lze se br\'e1nit a\'9e do vitality 0. V p\u345 ?\'edpad\u283 ?, \'9ee postava vy\u269 ?erp\'e1 ve\'9akerou vitalitu a st\'e1le je na ni veden \'fatok, nem\u367 ?\'9ee se u\'9e hnout a opustit boji\'9at\u283 ?, ale ani bojovat, tak\'9ee pokud ji nikdo jin\'fd nezachr\'e1n\'ed, pravd\u283 ?podobn\u283 ? nep\u345 ?e\'9eije. }
|
||||
\par \pard\plain \sb240\sa120\keepn\f4\i\shad\b\f7\fs28\i\b\f8\fs28\i\b\qj \ltrpar\s6\cf1\shad\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af1\afs28\lang255\ai\ab\ltrch\dbch\af1\afs28\langfe255\ai\ab\loch\f1\fs24\lang1029\i\b {\loch\f4\fs24\lang1029\i\b Rychlej\'9a\'ed obchodov\'e1n\'ed p\u345 ?i pou\'9eit\'ed CTRL }
|
||||
\par \pard\plain \ltrpar\s3\cf1\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\li283\ri0\lin283\rin0\fi283\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f2\fs20\lang1029 {\loch\f2\fs20\lang1029\i0\b0 Aktivuje mo\'9enost urychlen\'ed n\'e1kupu v obchodech. Pokud je v obchod\u283 ? p\u345 ?i vybr\'e1n\'ed p\u345 ?edm\u283 ?tu dr\'9eeno tla\u269 ?\'edtko CTRL, kliknut\'edm na p\u345 ?edm\u283 ?t u obchodn\'edka dojde automaticky k n\'e1kupu za b\u283 ?\'9enou cenu a vlo\'9een\'ed p\u345 ?edm\u283 ?tu do invent\'e1\u345 ?e aktu\'e1ln\'ed postavy. Pokud je za sou\u269 ?asn\'e9h
|
||||
o dr\'9een\'ed tla\u269 ?\'edtka CTRL kliknuto na p\u345 ?edm\u283 ?t v invent\'e1\u345 ?i, je p\u345 ?edm\u283 ?t ihned prod\'e1n za b\u283 ?\'9enou cenu. Nelze-li p\u345 ?edm\u283 ?t koupit nebo prodat, nestane se nic. }
|
||||
\par \pard\plain \sb240\sa120\keepn\f4\i\shad\b\f7\fs28\i\b\f8\fs28\i\b\qj \ltrpar\s6\cf1\shad\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af1\afs28\lang255\ai\ab\ltrch\dbch\af1\afs28\langfe255\ai\ab\loch\f1\fs24\lang1029\i\b {\loch\f4\fs24\lang1029\i\b Zobrazuj minimapu i mimo boj }
|
||||
\par \pard\plain \ltrpar\s3\cf1\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\li283\ri0\lin283\rin0\fi283\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f2\fs20\lang1029 {\loch\f2\fs20\lang1029\i0\b0 Pokud je volba aktivov\'e1na, zobrazuje malou mapu vlev\'e9 \u269 ?\'e1sti v\'fdhledu i mimo boj. Pokud se v\'9aak nebojuje, nejsou na map\u283 ? zobrazov\'e1ny nestv\u367 ?ry. }
|
||||
\par \pard\plain \sb240\sa120\keepn\f4\i\shad\b\f7\fs28\i\b\f8\fs28\i\b\qj \ltrpar\s6\cf1\shad\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af1\afs28\lang255\ai\ab\ltrch\dbch\af1\afs28\langfe255\ai\ab\loch\f1\fs24\lang1029\i\b {\loch\f4\fs24\lang1029\i\b Hromadn\'fd \'fat\u283 ?k z boje }
|
||||
\par \pard\plain \ltrpar\s3\cf1\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\li283\ri0\lin283\rin0\fi283\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f2\fs20\lang1029 {\loch\f2\fs20\lang1029\i0\b0 Aktivuje mo\'9enost hromadn\'e9ho \'fat\u283 ?ku z boje, pokud v\'9aechny postavy na aktu\'e1ln\'edm pol\'ed\u269 ?ku maj\'ed zvolenou akci {\b \'dat\u283 ?k}. Hromadn\'fd \'fat\u283 ?k prob\u283 ?hne b\u283 ?hem \'fat\u283 ?ku prvn\'ed postavy z boji\'9at\u283 ? (nen\'ed to nijak graficky odli\'9aeno). Hromadn\u283 ? lze ut\'edkat jen o tolik pol\'ed\u269 ?ek, o kolik m\u367 ?\'9e
|
||||
e ut\'edkat nejpomalej\'9a\'ed postava. Pokud n\u283 ?kter\'e1 postava nem\u367 ?\'9ee ut\'edkat (nem\'e1 vitalitu), hromadn\'fd \'fat\u283 ?k neprob\u283 ?hne. }
|
||||
\par \pard\plain \sb240\sa120\keepn\f4\i\shad\b\f7\fs28\i\b\f8\fs28\i\b\qj \ltrpar\s6\cf1\shad\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af1\afs28\lang255\ai\ab\ltrch\dbch\af1\afs28\langfe255\ai\ab\loch\f1\fs24\lang1029\i\b {\loch\f4\fs24\lang1029\i\b V\'9edy otev\u345 ?i knihu p\u345 ?i zm\u283 ?n\u283 ? obsahu }
|
||||
\par \pard\plain \ltrpar\s3\cf1\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\li283\ri0\lin283\rin0\fi283\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f2\fs20\lang1029 {\loch\f2\fs20\lang1029\i0\b0 Je-li volba aktivovan\'e1, v okam\'9eiku, kdy dojde p\u345 ?id\'e1n\'ed n\u283 ?jak\'e9ho textu do knihy se kniha automaticky otev\u345 ?e, aby si hr\'e1\u269 ? mohl nov\'fd text p\u345 ?e\u269 ?\'edst. }
|
||||
\par \pard\plain \sb240\sa120\keepn\f4\i\shad\b\f7\fs28\i\b\f8\fs28\i\b\qj \ltrpar\s6\cf1\shad\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af1\afs28\lang255\ai\ab\ltrch\dbch\af1\afs28\langfe255\ai\ab\loch\f1\fs24\lang1029\i\b {\loch\f4\fs24\lang1029\i\b V\'9edy zobraz sebranou runu }
|
||||
\par \pard\plain \ltrpar\s3\cf1\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\li283\ri0\lin283\rin0\fi283\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f2\fs20\lang1029 {\loch\f2\fs20\lang1029\i0\b0 Je-li volba aktivovan\'e1, p\u345 ?i sebr\'e1n\'ed runy se na chv\'edli zobrazi panel run s novou runou v okn\u283 ? na spodn\'edm panelu.}
|
||||
\par \pard\plain \sb240\sa120\keepn\f4\i\shad\b\f7\fs28\i\b\f8\fs28\i\b\qj \ltrpar\s6\cf1\shad\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\rtlch\af1\afs28\lang255\ai\ab\ltrch\dbch\af1\afs28\langfe255\ai\ab\loch\f1\fs24\lang1029\i\b {\loch\f4\fs24\lang1029\i\b Mal\'e9 nestv\u367 ?ry chod\'ed tak\'e9 diagon\'e1ln\u283 ?}
|
||||
\par \pard\plain \ltrpar\s3\cf1\qj{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\li283\ri0\lin283\rin0\fi283\rtlch\af1\afs24\lang255\ltrch\dbch\af1\afs24\langfe255\loch\f2\fs20\lang1029 {\loch\f2\fs20\lang1029\i0\b0 V p\u367 ?vodn\'edm n\'e1vrhu DOSov\'e9 verzi Skeldalu chodily nestv\u367 ?ry po \u269 ?tverc\'edch taky diagon\'e1ln\u283 ?, jakoby si zkracovali cestu. Nel\'edbilo se to ov\'9aem Napoleonovi, a tak bylo ustanoveno, \'9ee v\'9aechny nestv\u367 ?ry maj\'ed chod\'ed po \u269 ?tverc\'edch a to tak, \'9ee dojdou dobrost\u345 ?ed \u269 ?tverce a
|
||||
tam se oto\u269 ?\'ed do nov\'e9ho sm\u283 ?ru a pokra\u269 ?uj\'ed d\'e1l. }
|
||||
\par {\loch\f2\fs20\lang1029\i0\b0 Zapnut\'edm t\'e9to volby dojde k aktivaci p\u367 ?vodn\'edho chozen\'ed. Mal\'e9 nestv\u367 ?ry, to jsou takov\'e9, kter\'e9 se vejdou na jedno pol\'ed\u269 ?ko dvakr\'e1t, mohou chodit po diagon\'e1l\'e1ch a zkracovat si cestu, tak jak to byl p\u367 ?vodn\u283 ? zam\'fd\'9aleno. Tento re\'9eim ch\u367 ?ze plat\'ed jen mimo boj.}
|
||||
\par }
|
21
Windows/fiber_task.h
Normal file
21
Windows/fiber_task.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef __fiber_task_h_
|
||||
#define __fiber_task_h_
|
||||
|
||||
|
||||
#ifndef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
BIN
Windows/icon.bmp
Normal file
BIN
Windows/icon.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
Windows/icon.ico
Normal file
BIN
Windows/icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
325
Windows/install.cpp
Normal file
325
Windows/install.cpp
Normal file
|
@ -0,0 +1,325 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <commdlg.h>
|
||||
#include "install.h"
|
||||
#include "resource.h"
|
||||
#include <string.h>
|
||||
#include <SHLOBJ.H>
|
||||
extern "C"
|
||||
{
|
||||
#include <strlite.h>
|
||||
#include <inicfg.h>
|
||||
}
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static void correctfilter(char *z)
|
||||
{
|
||||
char *c;
|
||||
while ((c=strrchr(z,'|'))!=NULL) *c=0;
|
||||
}
|
||||
|
||||
static void CommDlgError(HWND owner, int error)
|
||||
{
|
||||
char *msg=0;
|
||||
switch (error)
|
||||
{
|
||||
case CDERR_DIALOGFAILURE: msg="CDERR_DIALOGFAILURE: The dialog box could not be created. The common dialog box function's call to the DialogBox function failed. For example, this error occurs if the common dialog box call specifies an invalid window handle. ";break;
|
||||
case CDERR_FINDRESFAILURE: msg="CDERR_FINDRESFAILURE: The common dialog box function failed to find a specified resource. ";break;
|
||||
case CDERR_INITIALIZATION: msg="CDERR_INITIALIZATION: The common dialog box function failed during initialization. This error often occurs when sufficient memory is not available. ";break;
|
||||
case CDERR_LOADRESFAILURE: msg="CDERR_LOADRESFAILURE: The common dialog box function failed to load a specified resource. ";break;
|
||||
case CDERR_LOADSTRFAILURE: msg="CDERR_LOADSTRFAILURE: The common dialog box function failed to load a specified string. ";break;
|
||||
case CDERR_LOCKRESFAILURE: msg="CDERR_LOCKRESFAILURE: The common dialog box function failed to lock a specified resource. ";break;
|
||||
case CDERR_MEMALLOCFAILURE: msg="CDERR_MEMALLOCFAILURE: The common dialog box function was unable to allocate memory for internal structures. ";break;
|
||||
case CDERR_MEMLOCKFAILURE: msg="CDERR_MEMLOCKFAILURE: The common dialog box function was unable to lock the memory associated with a handle. ";break;
|
||||
case CDERR_NOHINSTANCE: msg="CDERR_NOHINSTANCE: The ENABLETEMPLATE flag was set in the Flags member of the initialization structure for the corresponding common dialog box, but you failed to provide a corresponding instance handle. ";break;
|
||||
case CDERR_NOHOOK: msg="CDERR_NOHOOK: The ENABLEHOOK flag was set in the Flags member of the initialization structure for the corresponding common dialog box, but you failed to provide a pointer to a corresponding hook procedure. ";break;
|
||||
case CDERR_NOTEMPLATE: msg="CDERR_NOTEMPLATE: The ENABLETEMPLATE flag was set in the Flags member of the initialization structure for the corresponding common dialog box, but you failed to provide a corresponding template. ";break;
|
||||
case CDERR_REGISTERMSGFAIL: msg="CDERR_REGISTERMSGFAIL: The RegisterWindowMessage function returned an error code when it was called by the common dialog box function. ";break;
|
||||
case CDERR_STRUCTSIZE: msg="CDERR_STRUCTSIZE: The lStructSize member of the initialization structure for the corresponding common dialog box is invalid. ";break;
|
||||
case FNERR_BUFFERTOOSMALL: msg="FNERR_BUFFERTOOSMALL: The buffer pointed to by the lpstrFile member of the OPENFILENAME structure is too small for the file name specified by the user. The first two bytes of the lpstrFile buffer contain an integer value specifying the size, in TCHARs, required to receive the full name. ";break;
|
||||
case FNERR_INVALIDFILENAME: msg="FNERR_INVALIDFILENAME: A file name is invalid. ";break;
|
||||
case FNERR_SUBCLASSFAILURE: msg="FNERR_SUBCLASSFAILURE: An attempt to subclass a list box failed because sufficient memory was not available. ";;break;
|
||||
default: msg="Unknown CommDlgError.";break;
|
||||
}
|
||||
char *text=(char *)alloca(strlen(msg)+200);
|
||||
sprintf(text,"CommDlgError (%d / %04X)\r\n\r\nDescription:\r\n\r\n%s",error,error,msg);
|
||||
MessageBox(owner,text,NULL,MB_OK|MB_ICONEXCLAMATION);
|
||||
}
|
||||
|
||||
static bool VyberSlozku(HWND owner, char *slozka)
|
||||
{
|
||||
OPENFILENAME ofn;
|
||||
char filter[100];
|
||||
char title[100];
|
||||
LoadString(GetModuleHandle(NULL),IDS_INSTALLFILTER,filter,sizeof(filter));
|
||||
LoadString(GetModuleHandle(NULL),IDS_INSTALLTITLE,title,sizeof(title));
|
||||
LoadString(GetModuleHandle(NULL),IDS_INSTALLPRENAME,slozka,MAX_PATH);
|
||||
correctfilter(filter);
|
||||
memset(&ofn,0,sizeof(ofn));
|
||||
#ifdef OPENFILENAME_SIZE_VERSION_400
|
||||
ofn.lStructSize=OPENFILENAME_SIZE_VERSION_400;
|
||||
#else
|
||||
ofn.lStructSize=sizeof(ofn);
|
||||
#endif
|
||||
ofn.hwndOwner=owner;
|
||||
ofn.lpstrFilter=filter;
|
||||
ofn.lpstrFile=slozka;
|
||||
ofn.nMaxFile=MAX_PATH*4;
|
||||
ofn.lpstrTitle=title;
|
||||
ofn.Flags=OFN_PATHMUSTEXIST|OFN_HIDEREADONLY|OFN_NOCHANGEDIR;
|
||||
if (GetOpenFileName(&ofn)) return true;
|
||||
else
|
||||
{
|
||||
int err=CommDlgExtendedError();
|
||||
if (err) CommDlgError(owner,err);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static bool VyberCD(HWND owner, char *slozka)
|
||||
{
|
||||
OPENFILENAME ofn;
|
||||
char filter[100];
|
||||
char title[100];
|
||||
LoadString(GetModuleHandle(NULL),IDS_INSTALLCDFILTER,filter,sizeof(filter));
|
||||
LoadString(GetModuleHandle(NULL),IDS_INSTALLCDTITLE,title,sizeof(title));
|
||||
LoadString(GetModuleHandle(NULL),IDS_INSTALLCDFILE,slozka,MAX_PATH);
|
||||
correctfilter(filter);
|
||||
memset(&ofn,0,sizeof(ofn));
|
||||
#ifdef OPENFILENAME_SIZE_VERSION_400
|
||||
ofn.lStructSize=OPENFILENAME_SIZE_VERSION_400;
|
||||
#else
|
||||
ofn.lStructSize=sizeof(ofn);
|
||||
#endif
|
||||
ofn.hwndOwner=owner;
|
||||
ofn.lpstrFilter=filter;
|
||||
ofn.lpstrFile=slozka;
|
||||
ofn.nMaxFile=MAX_PATH*4;
|
||||
ofn.lpstrTitle=title;
|
||||
ofn.Flags=OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_NOCHANGEDIR;
|
||||
if (GetOpenFileName(&ofn)) return true;
|
||||
else {
|
||||
int err=CommDlgExtendedError();
|
||||
if (err) CommDlgError(owner,err);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static TSTR_LIST filetocopy=NULL;
|
||||
|
||||
static void FileSingleCopy(const char *src, const char *trg)
|
||||
{
|
||||
if (filetocopy==NULL) filetocopy=create_list(100);
|
||||
str_add(&filetocopy,(char *)src);
|
||||
str_add(&filetocopy,(char *)trg);
|
||||
}
|
||||
|
||||
static void FileCopy(HWND hWnd,const char *srcmask, const char *trgmask, const char *src, const char *trg)
|
||||
{
|
||||
char *fsrc=(char *)alloca((strlen(srcmask)+strlen(src))*2+MAX_PATH);
|
||||
char *ftrg=(char *)alloca((strlen(trgmask)+strlen(trg))*2+MAX_PATH);
|
||||
sprintf(fsrc,srcmask,src);
|
||||
sprintf(ftrg,trgmask,trg);
|
||||
strcat(ftrg,"\\");
|
||||
char *trgplace=strchr(ftrg,0);
|
||||
char *srcplace=strrchr(fsrc,'\\')+1;
|
||||
WIN32_FIND_DATA fdata;
|
||||
HANDLE h=FindFirstFile(fsrc,&fdata);
|
||||
if (h==INVALID_HANDLE_VALUE)
|
||||
{
|
||||
ResMessageBox2(hWnd,IDS_INSTALLCHYBISOUBOR,MB_ICONEXCLAMATION|MB_OK,fsrc);
|
||||
return;
|
||||
}
|
||||
if (h) do
|
||||
{
|
||||
if (!(fdata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
strcpy(trgplace,fdata.cFileName);
|
||||
strcpy(srcplace,fdata.cFileName);
|
||||
FileSingleCopy(fsrc,ftrg);
|
||||
}
|
||||
}
|
||||
while (FindNextFile(h,&fdata));
|
||||
FindClose(h);
|
||||
}
|
||||
|
||||
static void DirCreate(const char *srcmask, const char *src)
|
||||
{
|
||||
char *fsrc=(char *)alloca((strlen(srcmask)+strlen(src))*2+MAX_PATH);
|
||||
sprintf(fsrc,srcmask,src);
|
||||
CreateDirectory(fsrc,NULL);
|
||||
}
|
||||
|
||||
static BOOL CommitCopy(HWND hWnd)
|
||||
{
|
||||
int size=0;
|
||||
int i;
|
||||
for (i=0;i<str_count(filetocopy);i++) if (filetocopy[i]) size+=strlen(filetocopy[i])+10;
|
||||
char *buff=(char *)malloc(size);
|
||||
char *ptr=buff;
|
||||
char *trg;
|
||||
for (i=0;i<str_count(filetocopy);i+=2)
|
||||
if (filetocopy[i])
|
||||
{
|
||||
strcpy(ptr,filetocopy[i]);
|
||||
ptr=strchr(ptr,0)+1;
|
||||
}
|
||||
*ptr++=0;
|
||||
trg=ptr;
|
||||
for (i=1;i<str_count(filetocopy);i+=2)
|
||||
if (filetocopy[i])
|
||||
{
|
||||
strcpy(ptr,filetocopy[i]);
|
||||
ptr=strchr(ptr,0)+1;
|
||||
}
|
||||
*ptr++=0;
|
||||
release_list(filetocopy);
|
||||
filetocopy=NULL;
|
||||
SHFILEOPSTRUCT copyop;
|
||||
copyop.hwnd=hWnd;
|
||||
copyop.wFunc=FO_COPY;
|
||||
copyop.pFrom=buff;
|
||||
copyop.pTo=trg;
|
||||
copyop.fFlags=FOF_MULTIDESTFILES|FOF_NOCONFIRMATION|FOF_NOCONFIRMMKDIR ;
|
||||
copyop.fAnyOperationsAborted=TRUE;
|
||||
copyop.lpszProgressTitle="copying";
|
||||
if (SHFileOperation(©op)!=0) {free(buff);return FALSE;}
|
||||
if (copyop.fAnyOperationsAborted==TRUE) {free(buff);return FALSE;}
|
||||
free(buff);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HRESULT CreateLink(LPCSTR lpszPathObj,
|
||||
LPSTR lpszPathLink, LPSTR lpszDesc, LPSTR args)
|
||||
{
|
||||
HRESULT hres;
|
||||
IShellLink* psl;
|
||||
|
||||
// Get a pointer to the IShellLink interface.
|
||||
hres = CoCreateInstance(CLSID_ShellLink, NULL,
|
||||
CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl);
|
||||
if (SUCCEEDED(hres)) {
|
||||
char *wkd=strcpy((char*)alloca(strlen(lpszPathObj)+1),lpszPathObj);
|
||||
*strrchr(wkd,'\\')=0;
|
||||
IPersistFile* ppf;
|
||||
|
||||
// Set the path to the shortcut target and add the
|
||||
// description.
|
||||
psl->SetPath(lpszPathObj);
|
||||
psl->SetDescription( lpszDesc);
|
||||
psl->SetWorkingDirectory(wkd);
|
||||
if (args!=NULL) psl->SetArguments(args);
|
||||
|
||||
// Query IShellLink for the IPersistFile interface for saving the
|
||||
// shortcut in persistent storage.
|
||||
hres = psl->QueryInterface(IID_IPersistFile,
|
||||
(void **)&ppf);
|
||||
|
||||
if (SUCCEEDED(hres)) {
|
||||
wchar_t wsz[MAX_PATH];
|
||||
|
||||
// Ensure that the string is ANSI.
|
||||
MultiByteToWideChar(CP_ACP, 0, lpszPathLink, -1,
|
||||
wsz, MAX_PATH);
|
||||
|
||||
// Save the link by calling IPersistFile::Save.
|
||||
hres = ppf->Save(wsz, TRUE);
|
||||
ppf->Release();
|
||||
}
|
||||
psl->Release();
|
||||
}
|
||||
return hres;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void CreateLinkSkeldal(char *buff,char *slozka)
|
||||
{
|
||||
CoInitialize(NULL);
|
||||
GetModuleFileName(NULL,buff,MAX_PATH*4);
|
||||
char *c=strrchr(buff,'\\');
|
||||
strcat(slozka,c);
|
||||
SHGetSpecialFolderPath(NULL,buff,CSIDL_DESKTOPDIRECTORY,TRUE);
|
||||
strcat(buff,"\\");
|
||||
c=strchr(buff,0);
|
||||
LoadString(GetModuleHandle(NULL),IDS_WINTITLE,c,50);
|
||||
strcat(c,".lnk");
|
||||
CreateLink(slozka,buff,"",NULL);
|
||||
}
|
||||
|
||||
BOOL RunInstall(HWND hWnd)
|
||||
{
|
||||
char slozka[MAX_PATH*4];
|
||||
char cd[MAX_PATH*4];
|
||||
char mypath[MAX_PATH*4];
|
||||
TSTR_LIST ini;
|
||||
char *c;
|
||||
|
||||
if (ResMessageBox(hWnd,IDS_INSTALLTEXT1,MB_OKCANCEL)==IDCANCEL) return FALSE;
|
||||
if (VyberCD(hWnd,cd)==false) return FALSE;
|
||||
if (ResMessageBox(hWnd,IDS_INSTALLTEXT2,MB_OKCANCEL)==IDCANCEL) return FALSE;
|
||||
opakuj1:
|
||||
if (VyberSlozku(hWnd,slozka)==false) return FALSE;
|
||||
c=strrchr(slozka,'\\');
|
||||
if (c==NULL) goto opakuj1;
|
||||
c++;
|
||||
if (strstr(slozka,c)<c) c[-1]=0;
|
||||
if (SetCurrentDirectory(slozka)==FALSE)
|
||||
{
|
||||
if (ResMessageBox2(hWnd, IDS_CREATEDIR, MB_YESNO|MB_ICONQUESTION,slozka)==IDNO) goto opakuj1;
|
||||
if (CreateDirectory(slozka,NULL)==FALSE)
|
||||
{
|
||||
ResMessageBox2(hWnd,IDS_NELZEVYTVORITSLOZKU,MB_ICONSTOP|MB_OK,slozka);
|
||||
goto opakuj1;
|
||||
}
|
||||
if (SetCurrentDirectory(slozka)==FALSE) goto opakuj1;
|
||||
}
|
||||
c=strrchr(cd,'\\');
|
||||
*c=0;
|
||||
ini=create_list(1);
|
||||
GetModuleFileName(NULL,mypath,sizeof(mypath));
|
||||
FileCopy(hWnd,"%s","%s",mypath,slozka);
|
||||
if (ResMessageBox(hWnd,IDS_INSTALLHDD,MB_YESNO|MB_ICONQUESTION)==IDNO)
|
||||
{
|
||||
sprintf(mypath,"CESTA_MAPY %s\\maps\\",cd);str_add(&ini,mypath);
|
||||
sprintf(mypath,"CESTA_MUSIC %s\\music\\",cd);str_add(&ini,mypath);
|
||||
sprintf(mypath,"CESTA_VIDEO %s\\video\\",cd);str_add(&ini,mypath);
|
||||
sprintf(mypath,"CESTA_DATA %s\\",cd);str_add(&ini,mypath);
|
||||
}
|
||||
else
|
||||
{
|
||||
FileCopy(hWnd,"%s\\skeldal.ddl","%s",cd,slozka);
|
||||
FileCopy(hWnd,"%s\\popisy.enc","%s",cd,slozka);
|
||||
FileCopy(hWnd,"%s\\titulky.enc","%s",cd,slozka);
|
||||
FileCopy(hWnd,"%s\\endtext.enc","%s",cd,slozka);
|
||||
FileCopy(hWnd,"%s\\maps\\*.map","%s\\maps",cd,slozka);
|
||||
FileCopy(hWnd,"%s\\maps\\*.enc","%s\\maps",cd,slozka);
|
||||
FileCopy(hWnd,"%s\\maps\\*.dat","%s\\maps",cd,slozka);
|
||||
FileCopy(hWnd,"%s\\music\\*.mus","%s\\music",cd,slozka);
|
||||
FileCopy(hWnd,"%s\\video\\*.*","%s\\video",cd,slozka);
|
||||
sprintf(mypath,"CESTA_MAPY %s\\maps\\",slozka);str_add(&ini,mypath);
|
||||
sprintf(mypath,"CESTA_MUSIC %s\\music\\",slozka);str_add(&ini,mypath);
|
||||
sprintf(mypath,"CESTA_VIDEO %s\\video\\",slozka);str_add(&ini,mypath);
|
||||
sprintf(mypath,"CESTA_DATA %s\\",slozka);str_add(&ini,mypath);
|
||||
}
|
||||
EnableWindow(hWnd,FALSE);
|
||||
BOOL suces=CommitCopy(hWnd);
|
||||
EnableWindow(hWnd,TRUE);
|
||||
if (suces==FALSE) return FALSE;
|
||||
DirCreate("%s\\savegame",slozka);
|
||||
DirCreate("%s\\temp",slozka);
|
||||
sprintf(mypath,"CESTA_POZICE %s\\savegame\\",slozka);str_add(&ini,mypath);
|
||||
sprintf(mypath,"CESTA_TEMPY %s\\temp\\",slozka);str_add(&ini,mypath);
|
||||
sprintf(mypath,"CESTA_CD %s\\",cd);str_add(&ini,mypath);
|
||||
str_add(&ini,"vmode 0");
|
||||
str_add(&ini,"sound_device 9 0 0 0");
|
||||
str_add(&ini,"SOUND_MIXFREQ 44100");
|
||||
str_add(&ini,"default_map lespred.map");
|
||||
save_config(ini,SKELDALINI);
|
||||
release_list(ini);
|
||||
CreateLinkSkeldal(mypath,slozka);
|
||||
ResMessageBox(hWnd,IDS_INSTALLEDGAME,MB_OK|MB_ICONINFORMATION);
|
||||
return TRUE;
|
||||
}
|
5
Windows/install.h
Normal file
5
Windows/install.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
BOOL RunInstall(HWND hWnd);
|
||||
int ResMessageBox(HWND hWnd, UINT idc, UINT flags);
|
||||
int ResMessageBox2(HWND hWnd, UINT idc, UINT flags,...);
|
||||
HRESULT CreateLink(LPCSTR lpszPathObj, LPSTR lpszPathLink, LPSTR lpszDesc, LPSTR args);
|
||||
|
492
Windows/konfig.cpp
Normal file
492
Windows/konfig.cpp
Normal file
|
@ -0,0 +1,492 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <d3d9.h>
|
||||
#include <windowsx.h>
|
||||
#include <commctrl.h>
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
#include "resource.h"
|
||||
#include "konfig.h"
|
||||
#include "../game/extras.h"
|
||||
#include "richview.h"
|
||||
#include <shlobj.h>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include <strlite.h>
|
||||
#include <inicfg.h>
|
||||
}
|
||||
|
||||
static HWND handles[5];
|
||||
static HWND konfigHelp;
|
||||
|
||||
#define CFGCHEATS 4
|
||||
#define CFGEXTRAS 3
|
||||
#define CFGSOUND 1
|
||||
#define CFGVIDEO 2
|
||||
#define CFGGENERAL 0
|
||||
|
||||
static LRESULT NullProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static HANDLE StartHelp(HWND hDlg, const char *process,const char *helppathname)
|
||||
{
|
||||
SHELLEXECUTEINFO nfo;
|
||||
|
||||
memset(&nfo,0,sizeof(nfo));
|
||||
nfo.cbSize=sizeof(nfo);
|
||||
nfo.fMask=SEE_MASK_DOENVSUBST|SEE_MASK_NOCLOSEPROCESS;
|
||||
nfo.hwnd=hDlg;
|
||||
nfo.lpFile=process;
|
||||
nfo.lpParameters=helppathname;
|
||||
nfo.nShow=SW_NORMAL;
|
||||
if (ShellExecuteEx(&nfo)==0) return NULL;
|
||||
return nfo.hProcess;
|
||||
}
|
||||
|
||||
static void ShowHelp(HWND hDlg, char *helpname)
|
||||
{
|
||||
SetCursor(LoadCursor(NULL,IDC_WAIT));
|
||||
HINSTANCE hInstance=GetModuleHandle(NULL);
|
||||
HRSRC rscr=FindResource(hInstance,helpname,RT_HTML);
|
||||
HGLOBAL hglob=LoadResource(hInstance,rscr);
|
||||
void *ptr=LockResource(hglob);
|
||||
DWORD sz=SizeofResource(hInstance,rscr);
|
||||
DWORD wrt;
|
||||
char buff[MAX_PATH*2];
|
||||
GetTempPath(sizeof(buff),buff);
|
||||
strcat(buff,helpname);
|
||||
HANDLE file=CreateFile(buff,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
|
||||
WriteFile(file,ptr,sz,&wrt,NULL);
|
||||
CloseHandle(file);
|
||||
HANDLE hlp=StartHelp(hDlg,"hh",buff);
|
||||
if (hlp==NULL) hlp=StartHelp(hDlg,"iexplore",buff);
|
||||
if (hlp==NULL) {hlp=StartHelp(hDlg,buff,NULL);}
|
||||
for (int i=0;i<10;i++) {WaitForInputIdle(hlp,10000); Sleep(10);}
|
||||
while (DeleteFile(buff)==FALSE)
|
||||
{WaitForInputIdle(hlp,10000); Sleep(10);}
|
||||
CloseHandle(hlp);
|
||||
}
|
||||
|
||||
static bool ModeWarning()
|
||||
{
|
||||
DEVMODE devmode;
|
||||
devmode.dmSize=sizeof(DEVMODE);
|
||||
EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&devmode);
|
||||
return devmode.dmBitsPerPel!=16;
|
||||
}
|
||||
|
||||
int ResMessageBox(HWND hWnd, UINT idc, UINT flags)
|
||||
{
|
||||
char buff1[1024],buff2[256];
|
||||
HINSTANCE hInst=GetModuleHandle(NULL);
|
||||
LoadString(hInst,idc,buff1,sizeof(buff1));
|
||||
LoadString(hInst,IDS_WINTITLE,buff2,sizeof(buff2));
|
||||
return MessageBox(hWnd,buff1,buff2,flags);
|
||||
}
|
||||
|
||||
int ResMessageBox2(HWND hWnd, UINT idc, UINT flags,...)
|
||||
{
|
||||
char buff1[1024],buff2[256],buff3[2048];
|
||||
va_list args;
|
||||
va_start(args,flags);
|
||||
HINSTANCE hInst=GetModuleHandle(NULL);
|
||||
LoadString(hInst,idc,buff1,sizeof(buff1));
|
||||
LoadString(hInst,IDS_WINTITLE,buff2,sizeof(buff2));
|
||||
_vsnprintf(buff3,sizeof(buff3),buff1,args);
|
||||
return MessageBox(hWnd,buff3,buff2,flags);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include "WAPlayer.h"
|
||||
static WAPlayer GWinAmpPlayer;
|
||||
|
||||
static bool FillListOfPlugins(WAPlayer &player, WAInputPlugin &inplug, void *context)
|
||||
{
|
||||
HWND list=(HWND)context;
|
||||
int i=ListBox_AddString(list,inplug.GetDescription());
|
||||
ListBox_SetItemData(list,i,(LPARAM)&inplug);
|
||||
return true;
|
||||
}
|
||||
|
||||
static void UpdateListOfWinampPlugins(HWND okno)
|
||||
{
|
||||
int len=GetWindowTextLength(GetDlgItem(okno,IDC_CESTANAPLUGINY));
|
||||
char *path=(char *)alloca(len+1);
|
||||
GetWindowText(GetDlgItem(okno,IDC_CESTANAPLUGINY),path,len+1);
|
||||
GWinAmpPlayer.LoadPlugins(path);
|
||||
ListBox_ResetContent(GetDlgItem(okno,IDC_PLUGLIST));
|
||||
GWinAmpPlayer.EnumPlugins(FillListOfPlugins,(void *)GetDlgItem(okno,IDC_PLUGLIST));
|
||||
}
|
||||
|
||||
static int WINAPI PosBrowseCallbackProc(HWND hwnd,UINT uMsg,LPARAM lParam,LPARAM lpData)
|
||||
{
|
||||
const char *curpath=(const char *)lpData;
|
||||
if (uMsg == BFFM_INITIALIZED)
|
||||
{
|
||||
if (curpath && curpath[0])
|
||||
{
|
||||
::SendMessage(hwnd,BFFM_SETSELECTION,TRUE,(LPARAM)((LPCSTR)curpath));
|
||||
::SendMessage(hwnd,BFFM_SETSTATUSTEXT,0,(LPARAM)((LPCSTR)curpath));
|
||||
}
|
||||
}
|
||||
else if (uMsg == BFFM_SELCHANGED)
|
||||
{
|
||||
char buff[_MAX_PATH];
|
||||
if (SHGetPathFromIDList((LPITEMIDLIST)lParam,buff))
|
||||
{
|
||||
::SendMessage(hwnd,BFFM_SETSTATUSTEXT,0,(LPARAM)buff);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
static bool PathBrowser(HWND hWnd, char *path /* MAX_PATH size */)
|
||||
{
|
||||
BROWSEINFO brw;
|
||||
memset(&brw,0,sizeof(brw));
|
||||
brw.hwndOwner=hWnd;
|
||||
brw.pidlRoot=NULL;
|
||||
brw.pszDisplayName=path;
|
||||
brw.lParam=(LPARAM)path;
|
||||
#ifdef BIF_USENEWUI
|
||||
brw.ulFlags= BIF_RETURNONLYFSDIRS |BIF_STATUSTEXT|BIF_USENEWUI ;
|
||||
#else
|
||||
brw.ulFlags= BIF_RETURNONLYFSDIRS |BIF_STATUSTEXT ;
|
||||
#endif
|
||||
brw.lpfn = (BFFCALLBACK)(PosBrowseCallbackProc);
|
||||
LPITEMIDLIST il=SHBrowseForFolder( &brw );
|
||||
if (il==NULL) return false;
|
||||
SHGetPathFromIDList(il,path);
|
||||
IMalloc *shmalloc;
|
||||
SHGetMalloc(&shmalloc);
|
||||
shmalloc->Free(il);
|
||||
if (path[0]==0) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void BrowseCestaNaPluginy(HWND main, HWND control)
|
||||
{
|
||||
int len=GetWindowTextLength(control);
|
||||
len+=MAX_PATH;
|
||||
char *path=(char *)alloca(len+1);
|
||||
GetWindowText(control,path,len+1);
|
||||
if (PathBrowser(main,path))
|
||||
{
|
||||
SetWindowText(control,path);
|
||||
UpdateListOfWinampPlugins(main);
|
||||
}
|
||||
}
|
||||
|
||||
static void OnPlugVlastnosti(HWND hDlg)
|
||||
{
|
||||
HWND list=GetDlgItem(hDlg,IDC_PLUGLIST);
|
||||
int cursel=ListBox_GetCurSel(list);
|
||||
if (cursel<0)
|
||||
{
|
||||
char buff[256];
|
||||
LoadString((HINSTANCE)GetWindowLong(hDlg,GWL_HINSTANCE),IDS_NICVYBRANO,buff,256);
|
||||
MessageBox(hDlg,buff,0,MB_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
WAInputPlugin *p=(WAInputPlugin *)ListBox_GetItemData(list,cursel);
|
||||
p->UIConfig(hDlg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static LRESULT SubDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
int idCtrl = (int) wParam;
|
||||
LPNMHDR pnmh = (LPNMHDR) lParam;
|
||||
switch (idCtrl)
|
||||
{
|
||||
case IDC_GAMESPEED:
|
||||
SetDlgItemInt(hDlg,IDC_GAMESPEEDINFO,SendDlgItemMessage(hDlg,IDC_GAMESPEED,TBM_GETPOS,0,0),FALSE);break;
|
||||
default:return 0;
|
||||
}
|
||||
}
|
||||
case WM_COMMAND:
|
||||
{
|
||||
BOOL tmp;
|
||||
int idCtrl=LOWORD(wParam);
|
||||
switch (idCtrl)
|
||||
{
|
||||
case IDC_WINDOWED:
|
||||
tmp=IsDlgButtonChecked(hDlg,idCtrl)==BST_CHECKED;
|
||||
if (tmp && ModeWarning())
|
||||
ResMessageBox(hDlg,IDS_SCREENBPPWARNING,MB_OK|MB_ICONINFORMATION);
|
||||
EnableWindow(GetDlgItem(hDlg,IDC_ZOOM1),tmp);
|
||||
EnableWindow(GetDlgItem(hDlg,IDC_ZOOM2),tmp);
|
||||
EnableWindow(GetDlgItem(hDlg,IDC_ZOOM3),tmp);
|
||||
break;
|
||||
case IDC_GAMESPEEDDEFAULT:
|
||||
SendDlgItemMessage(hDlg,IDC_GAMESPEED,TBM_SETPOS,1,20-6);
|
||||
SendDlgItemMessage(hDlg,IDC_BATTLEACC,TBM_SETPOS,1,0);break;
|
||||
case IDC_NOHUNGRY:
|
||||
case IDC_DEBUGCONSOLE:
|
||||
if (IsDlgButtonChecked(hDlg,idCtrl)==BST_CHECKED)
|
||||
{
|
||||
if (ResMessageBox(hDlg,IDS_CHEATWARNING1,MB_YESNO|MB_ICONQUESTION)!=IDYES ||
|
||||
ResMessageBox(hDlg,IDS_CHEATWARNING2,MB_OKCANCEL|MB_ICONINFORMATION)!=IDCANCEL ||
|
||||
ResMessageBox(hDlg,IDS_CHEATWARNING3,MB_RETRYCANCEL|MB_ICONEXCLAMATION)!=IDRETRY ||
|
||||
ResMessageBox(hDlg,IDS_CHEATWARNING4,MB_ABORTRETRYIGNORE|MB_ICONSTOP)!=IDIGNORE)
|
||||
CheckDlgButton(hDlg,idCtrl,BST_UNCHECKED);
|
||||
else
|
||||
ResMessageBox(hDlg,IDS_CHEATWARNING5,MB_OK|MB_ICONEXCLAMATION);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case IDC_CESTANAPLUGINY:
|
||||
BrowseCestaNaPluginy(hDlg,GetDlgItem(hDlg,IDC_CESTANAPLUGINY));
|
||||
UpdateListOfWinampPlugins(hDlg);
|
||||
break;
|
||||
case IDC_PLUGVLASTNOSTI:
|
||||
OnPlugVlastnosti(hDlg);
|
||||
break;
|
||||
case IDC_PLUGLIST:
|
||||
if (HIWORD(wParam)==LBN_DBLCLK) OnPlugVlastnosti(hDlg);
|
||||
break;
|
||||
case IDC_PLUGINYNAPOVEDA:
|
||||
{
|
||||
if (konfigHelp) DestroyWindow(konfigHelp);
|
||||
konfigHelp=(HWND)ShowRichView(hDlg,MAKEINTRESOURCE(IDR_WINAMPPLUGS),"RTF",false);
|
||||
RECT rc1,rc2;
|
||||
SystemParametersInfo(SPI_GETWORKAREA,0,&rc1,0);
|
||||
GetWindowRect(konfigHelp,&rc2);
|
||||
SetWindowPos(konfigHelp,NULL,rc1.right-rc2.right+rc2.left,0,0,0,SWP_NOSIZE|SWP_NOZORDER);
|
||||
break;
|
||||
}
|
||||
case IDC_EXTRASHELP:
|
||||
{
|
||||
if (konfigHelp) DestroyWindow(konfigHelp);
|
||||
konfigHelp=(HWND)ShowRichView(hDlg,MAKEINTRESOURCE(IDR_EXTRAS),"RTF",false);
|
||||
RECT rc1,rc2;
|
||||
SystemParametersInfo(SPI_GETWORKAREA,0,&rc1,0);
|
||||
GetWindowRect(konfigHelp,&rc2);
|
||||
SetWindowPos(konfigHelp,NULL,rc1.right-rc2.right+rc2.left,0,0,0,SWP_NOSIZE|SWP_NOZORDER);
|
||||
break;
|
||||
}
|
||||
default:return 0;
|
||||
}
|
||||
}
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
if (IsWindowVisible(handles[CFGCHEATS]))
|
||||
{
|
||||
EnableWindow(GetDlgItem(handles[CFGCHEATS],IDC_NOHUNGRY),FALSE);
|
||||
EnableWindow(GetDlgItem(handles[CFGCHEATS],IDC_DEBUGCONSOLE),FALSE);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
default: return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void LoadSubDialog(HWND hParent, int pos, int uid, DLGPROC dlgproc)
|
||||
{
|
||||
RECT rc;
|
||||
handles[pos]=CreateDialog(GetModuleHandle(NULL),MAKEINTRESOURCE(uid),hParent,dlgproc);
|
||||
ShowWindow(handles[pos],SW_HIDE);
|
||||
GetWindowRect(GetDlgItem(hParent,IDC_CLIENTDESK),&rc);
|
||||
ScreenToClient(hParent,(POINT *)&rc.left);
|
||||
ScreenToClient(hParent,(POINT *)&rc.right);
|
||||
MoveWindow(handles[pos],rc.left,rc.top,rc.right-rc.left,rc.bottom-rc.top,FALSE);
|
||||
}
|
||||
|
||||
static int GetCountOfMonitors()
|
||||
{
|
||||
IDirect3D9 *dx=Direct3DCreate9(D3D_SDK_VERSION);
|
||||
if (dx==NULL) return 1;
|
||||
int num=dx->GetAdapterCount();
|
||||
dx->Release();
|
||||
return num;
|
||||
}
|
||||
|
||||
static void SetupDialog()
|
||||
{
|
||||
int num;
|
||||
TSTR_LIST lst=read_config(SKELDALINI);
|
||||
SendDlgItemMessage(handles[CFGGENERAL],IDC_GAMESPEED,TBM_SETRANGE,1,MAKELONG(1, 20));
|
||||
SendDlgItemMessage(handles[CFGGENERAL],IDC_BATTLEACC,TBM_SETRANGE,1,MAKELONG(0, 5));
|
||||
SendDlgItemMessage(handles[CFGSOUND],IDC_SNDMUSIC,TBM_SETRANGE,1,MAKELONG(0,127));
|
||||
SendDlgItemMessage(handles[CFGSOUND],IDC_SNDFX,TBM_SETRANGE,1,MAKELONG(0,255));
|
||||
CheckDlgButton(handles[CFGGENERAL],IDC_WINDOWED,(get_num_field(lst,"WINDOWED",&num)==0 && num==1)?BST_CHECKED:BST_UNCHECKED);
|
||||
CheckDlgButton(handles[CFGGENERAL],IDC_PRELOAD,(get_num_field(lst,"PRELOAD",&num)==0 && num==1)?BST_CHECKED:BST_UNCHECKED);
|
||||
CheckDlgButton(handles[CFGGENERAL],IDC_AUTOSAVE,(get_num_field(lst,"AUTOSAVE",&num)==0 && num==1)?BST_CHECKED:BST_UNCHECKED);
|
||||
num=6;get_num_field(lst,"GAME_SPEED",&num);
|
||||
num=20-num;
|
||||
SendDlgItemMessage(handles[CFGGENERAL],IDC_GAMESPEED,TBM_SETPOS,1,num);
|
||||
num=0;get_num_field(lst,"BATTLE_ACCEL",&num);
|
||||
SendDlgItemMessage(handles[CFGGENERAL],IDC_BATTLEACC,TBM_SETPOS,1,num);
|
||||
SetDlgItemInt(handles[CFGGENERAL],IDC_GAMESPEEDINFO,num,FALSE);
|
||||
num=44100;get_num_field(lst,"SOUND_MIXFREQ",&num);
|
||||
SetDlgItemInt(handles[CFGSOUND],IDC_MIXFREQ,num,FALSE);
|
||||
num=127;get_num_field(lst,"MUSIC_VOLUME",&num);
|
||||
SendDlgItemMessage(handles[CFGSOUND],IDC_SNDMUSIC,TBM_SETPOS,1,num);
|
||||
num=255;get_num_field(lst,"SOUND_VOLUME",&num);
|
||||
SendDlgItemMessage(handles[CFGSOUND],IDC_SNDFX,TBM_SETPOS,1,num);
|
||||
CheckDlgButton(handles[CFGVIDEO],IDC_SKIPINTRO,(get_num_field(lst,"SKIP_INTRO",&num)==0 && num==1)?BST_CHECKED:BST_UNCHECKED);
|
||||
CheckDlgButton(handles[CFGVIDEO],IDC_FULLRESVIDEO,(get_num_field(lst,"FULLRESVIDEO",&num)==0 && num==1)?BST_CHECKED:BST_UNCHECKED);
|
||||
num=1;get_num_field(lst,"WINDOWEDZOOM",&num);
|
||||
CheckRadioButton(handles[CFGGENERAL],IDC_ZOOM1,IDC_ZOOM3,IDC_ZOOM1+num-1);
|
||||
num=0;get_num_field(lst,"MONITOR",&num);
|
||||
CheckRadioButton(handles[CFGGENERAL],IDC_MON1,IDC_MON3,IDC_MON1+num);
|
||||
const char *cestaNaPluginy=get_text_field(lst,"CESTA_PLUGINS");
|
||||
if (cestaNaPluginy==0)
|
||||
{
|
||||
char *cesta=AutodetectWinAmp();
|
||||
SetDlgItemText(handles[CFGSOUND],IDC_CESTANAPLUGINY,cesta);
|
||||
free(cesta);
|
||||
}
|
||||
else
|
||||
SetDlgItemText(handles[CFGSOUND],IDC_CESTANAPLUGINY,cestaNaPluginy);
|
||||
UpdateListOfWinampPlugins(handles[CFGSOUND]);
|
||||
int moncnt=GetCountOfMonitors();
|
||||
if (moncnt<3) EnableWindow(GetDlgItem(handles[CFGGENERAL],IDC_MON3),FALSE);
|
||||
if (moncnt<2) EnableWindow(GetDlgItem(handles[CFGGENERAL],IDC_MON2),FALSE);
|
||||
num=0;get_num_field(lst,"EXTRAS",&num);
|
||||
for (int i=0;i<16;i++)
|
||||
{
|
||||
int p=1<<i;
|
||||
if (num & p)
|
||||
if (p==EX_NOHUNGRY) CheckDlgButton(handles[CFGCHEATS],IDC_NOHUNGRY,BST_CHECKED);
|
||||
else CheckDlgButton(handles[CFGEXTRAS],2000+i,BST_CHECKED);
|
||||
}
|
||||
num=0;get_num_field(lst,"DEBUG",&num);
|
||||
if (num) CheckDlgButton(handles[CFGCHEATS],IDC_DEBUGCONSOLE,BST_CHECKED);
|
||||
if (num>1) SetDlgItemInt(handles[CFGCHEATS],IDC_CHEATPASSWORD,num,FALSE);
|
||||
release_list(lst);
|
||||
}
|
||||
|
||||
static int RadioButtonChecked(HWND hWnd, int min, int max)
|
||||
{
|
||||
for (int i=min;i<=max;i++)
|
||||
{
|
||||
if (IsDlgButtonChecked(hWnd,i)==BST_CHECKED) return i-min;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void SaveKonfig(HWND hDlg)
|
||||
{
|
||||
TSTR_LIST lst=read_config(SKELDALINI);
|
||||
add_field_num(&lst,"WINDOWED",IsDlgButtonChecked(handles[CFGGENERAL],IDC_WINDOWED)==BST_CHECKED);
|
||||
add_field_num(&lst,"PRELOAD",IsDlgButtonChecked(handles[CFGGENERAL],IDC_PRELOAD)==BST_CHECKED);
|
||||
add_field_num(&lst,"AUTOSAVE",IsDlgButtonChecked(handles[CFGGENERAL],IDC_AUTOSAVE)==BST_CHECKED);
|
||||
add_field_num(&lst,"SKIP_INTRO",IsDlgButtonChecked(handles[CFGVIDEO],IDC_SKIPINTRO)==BST_CHECKED);
|
||||
add_field_num(&lst,"FULLRESVIDEO",IsDlgButtonChecked(handles[CFGVIDEO],IDC_FULLRESVIDEO)==BST_CHECKED);
|
||||
add_field_num(&lst,"DEBUG",IsDlgButtonChecked(handles[CFGCHEATS],IDC_DEBUGCONSOLE)==BST_CHECKED);
|
||||
int mixfreq=GetDlgItemInt(handles[CFGSOUND],IDC_MIXFREQ,NULL,FALSE);
|
||||
if (mixfreq<8000 || mixfreq>44100)
|
||||
ResMessageBox(hDlg,IDS_MIXFREQINVALID,MB_OK|MB_ICONEXCLAMATION);
|
||||
else
|
||||
add_field_num(&lst,"SOUND_MIXFREQ",mixfreq);
|
||||
add_field_num(&lst,"MUSIC_VOLUME",SendDlgItemMessage(handles[CFGSOUND],IDC_SNDMUSIC,TBM_GETPOS,0,0));
|
||||
add_field_num(&lst,"SOUND_VOLUME",SendDlgItemMessage(handles[CFGSOUND],IDC_SNDFX,TBM_GETPOS,0,0));
|
||||
add_field_num(&lst,"GAME_SPEED",20-SendDlgItemMessage(handles[CFGGENERAL],IDC_GAMESPEED,TBM_GETPOS,0,0));
|
||||
add_field_num(&lst,"BATTLE_ACCEL",SendDlgItemMessage(handles[CFGGENERAL],IDC_BATTLEACC,TBM_GETPOS,0,0));
|
||||
add_field_num(&lst,"WINDOWEDZOOM",RadioButtonChecked(handles[CFGGENERAL],IDC_ZOOM1,IDC_ZOOM3)+1);
|
||||
add_field_num(&lst,"MONITOR",RadioButtonChecked(handles[CFGGENERAL],IDC_MON1,IDC_MON3));
|
||||
int acc=0;
|
||||
for (int i=0;i<16;i++)
|
||||
{
|
||||
int p=1<<i;
|
||||
if (p==EX_NOHUNGRY && IsDlgButtonChecked(handles[CFGCHEATS],IDC_NOHUNGRY)==BST_CHECKED) acc+=p;
|
||||
else if (IsDlgButtonChecked(handles[CFGEXTRAS],2000+i)==BST_CHECKED) acc+=p;
|
||||
}
|
||||
add_field_num(&lst,"EXTRAS",acc);
|
||||
acc=GetDlgItemInt(handles[CFGCHEATS],IDC_CHEATPASSWORD,NULL,FALSE);
|
||||
if (acc>1) add_field_num(&lst,"DEBUG",acc);
|
||||
acc=GetWindowTextLength(GetDlgItem(handles[CFGSOUND],IDC_CESTANAPLUGINY));
|
||||
char *buff=(char *)alloca(acc+1);
|
||||
GetWindowText(GetDlgItem(handles[CFGSOUND],IDC_CESTANAPLUGINY),buff,acc+1);
|
||||
add_field_txt(&lst,"CESTA_PLUGINS",buff);
|
||||
save_config(lst,SKELDALINI);
|
||||
}
|
||||
|
||||
static LRESULT KonfigProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
LoadSubDialog(hDlg,CFGGENERAL,IDD_CFGGENERAL,(DLGPROC)SubDlgProc);
|
||||
LoadSubDialog(hDlg,CFGSOUND,IDD_CFGSOUND,(DLGPROC)SubDlgProc);
|
||||
LoadSubDialog(hDlg,CFGVIDEO,IDD_CFGVIDEO,(DLGPROC)NullProc);
|
||||
LoadSubDialog(hDlg,CFGEXTRAS,IDD_CFGEXTRAS,(DLGPROC)SubDlgProc);
|
||||
LoadSubDialog(hDlg,CFGCHEATS,IDD_CFGCHEATS,(DLGPROC)SubDlgProc);
|
||||
{
|
||||
for (int i=0;i<5;i++)
|
||||
{
|
||||
TCITEM item;
|
||||
char buff[256];
|
||||
item.mask=TCIF_TEXT;
|
||||
LoadString(GetModuleHandle(NULL),IDS_CFGGENERAL+i,buff,sizeof(buff));
|
||||
item.pszText=buff;
|
||||
SendDlgItemMessage(hDlg,IDC_TAB,TCM_INSERTITEM,i,(LPARAM)&item);
|
||||
}
|
||||
ShowWindow(handles[0],SW_SHOW);
|
||||
SetupDialog();
|
||||
}
|
||||
konfigHelp=NULL;
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
LPNMHDR lpnmhdr = (LPNMHDR) lParam;
|
||||
if (lpnmhdr->idFrom==IDC_TAB && lpnmhdr->code==TCN_SELCHANGE)
|
||||
{
|
||||
int cursel=TabCtrl_GetCurSel(GetDlgItem(hDlg,IDC_TAB));
|
||||
for (int i=0;i<5;i++)
|
||||
ShowWindow(handles[i],i==cursel?SW_SHOW:SW_HIDE);
|
||||
if (cursel==CFGCHEATS)
|
||||
{
|
||||
EnableWindow(GetDlgItem(handles[cursel],IDC_NOHUNGRY),TRUE);
|
||||
EnableWindow(GetDlgItem(handles[cursel],IDC_DEBUGCONSOLE),TRUE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDCANCEL: EndDialog(hDlg,0);break;
|
||||
case IDOK: SaveKonfig(hDlg);EndDialog(hDlg,1);break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
case WM_DESTROY:
|
||||
konfigHelp=NULL;
|
||||
break;
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
if (IsWindowVisible(handles[CFGCHEATS]))
|
||||
{
|
||||
EnableWindow(GetDlgItem(handles[CFGCHEATS],IDC_NOHUNGRY),FALSE);
|
||||
EnableWindow(GetDlgItem(handles[CFGCHEATS],IDC_DEBUGCONSOLE),FALSE);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
default: return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void OpenKonfig(HWND hParent)
|
||||
{
|
||||
DialogBoxParam(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_CFGTABDIALOG),hParent,(DLGPROC)KonfigProc,NULL);
|
||||
GWinAmpPlayer.ClearList();
|
||||
}
|
1
Windows/konfig.h
Normal file
1
Windows/konfig.h
Normal file
|
@ -0,0 +1 @@
|
|||
void OpenKonfig(HWND hParent);
|
BIN
Windows/logo.bmp
Normal file
BIN
Windows/logo.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
2
Windows/mem.h
Normal file
2
Windows/mem.h
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include <string.h>
|
||||
#include <malloc.h>
|
0
Windows/plugins.rtf
Normal file
0
Windows/plugins.rtf
Normal file
139
Windows/resource.h
Normal file
139
Windows/resource.h
Normal file
|
@ -0,0 +1,139 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by Skeldal.rc
|
||||
//
|
||||
#define IDS_WINTITLE 1
|
||||
#define IDS_CFGGENERAL 100
|
||||
#define IDR_BOLDCZ 101
|
||||
#define IDS_CFGSOUND 101
|
||||
#define IDD_LADICIOKNO 102
|
||||
#define IDS_CFGVIDEO 102
|
||||
#define IDD_INPUTWINDOW 103
|
||||
#define IDS_CFGEXTRAS 103
|
||||
#define IDB_INITLOGO 104
|
||||
#define IDD_CFGSOUND 104
|
||||
#define IDS_CFGCHEATS 104
|
||||
#define IDD_CFGTABDIALOG 105
|
||||
#define IDS_NICVYBRANO 105
|
||||
#define IDD_CFGGENERAL 106
|
||||
#define IDD_CFGVIDEO 109
|
||||
#define IDD_CFGEXTRAS 111
|
||||
#define IDD_CFGCHEATS 112
|
||||
#define IDB_UVODNIPOZADI 113
|
||||
#define IDB_UVODNISELECT 114
|
||||
#define IDD_INSTALL 115
|
||||
#define IDI_MAINICON 117
|
||||
#define IDD_RTFVIEWER 122
|
||||
#define IDR_EXTRAS 124
|
||||
#define IDD_SELADV 128
|
||||
#define IDB_SELADVDLG 130
|
||||
#define IDR_WINAMPPLUGS 131
|
||||
#define IDD_DIALOG1 132
|
||||
#define IDD_LISTDIALOG 132
|
||||
#define IDS_CHEATWARNING1 200
|
||||
#define IDS_CHEATWARNING2 201
|
||||
#define IDS_CHEATWARNING3 202
|
||||
#define IDS_CHEATWARNING4 203
|
||||
#define IDS_CHEATWARNING5 204
|
||||
#define IDS_RICHEDMISSING 205
|
||||
#define IDS_MIXFREQINVALID 206
|
||||
#define IDS_SCREENBPPWARNING 207
|
||||
#define IDS_INSTALLFILTER 208
|
||||
#define IDS_INSTALLTITLE 209
|
||||
#define IDS_INSTALLPRENAME 210
|
||||
#define IDS_INSTALLCDFILE 211
|
||||
#define IDS_INSTALLCDTITLE 212
|
||||
#define IDS_INSTALLCDFILTER 213
|
||||
#define IDS_CREATEDIR 214
|
||||
#define IDS_NELZEVYTVORITSLOZKU 215
|
||||
#define IDS_INSTALLEDGAME 216
|
||||
#define IDS_INSTALLHDD 217
|
||||
#define IDS_INSTALLCHYBISOUBOR 218
|
||||
#define IDS_INSTALLTEXT1 219
|
||||
#define IDS_INSTALLTEXT2 220
|
||||
#define IDS_DEFAULTADV 221
|
||||
#define IDC_OUTPUT 1000
|
||||
#define IDC_ADVENCE 1001
|
||||
#define IDC_VALUE 1002
|
||||
#define IDC_CLEARMAP 1003
|
||||
#define IDC_RAISEDEATH 1004
|
||||
#define IDC_GOTO 1005
|
||||
#define IDC_PROMPT 1005
|
||||
#define IDC_IMMORTAL 1006
|
||||
#define IDC_TAB 1006
|
||||
#define IDC_RAISEMONSTER 1007
|
||||
#define IDC_WINDOWED 1007
|
||||
#define IDC_LOADITEM 1008
|
||||
#define IDC_PRELOAD 1008
|
||||
#define IDC_LOADMAP 1009
|
||||
#define IDC_AUTOSAVE 1009
|
||||
#define IDC_NETECNOST 1010
|
||||
#define IDC_OPENDOOR 1011
|
||||
#define IDC_GAMESPEED 1011
|
||||
#define IDC_PURGE 1012
|
||||
#define IDC_GAMESPEEDINFO 1012
|
||||
#define IDC_REFRESH 1013
|
||||
#define IDC_MIXFREQ 1013
|
||||
#define IDC_RELOADMOBILES 1014
|
||||
#define IDC_TAKEMONEY 1015
|
||||
#define IDC_UNAFFECT 1016
|
||||
#define IDC_SNDMUSIC 1016
|
||||
#define IDC_WEAPONSKILL 1017
|
||||
#define IDC_SNDFX 1017
|
||||
#define IDC_HEAL 1018
|
||||
#define IDC_SKIPINTRO 1019
|
||||
#define IDC_FULLRESVIDEO 1020
|
||||
#define IDC_DEBUGCONSOLE 1021
|
||||
#define IDC_NOHUNGRY 1022
|
||||
#define IDC_INSTALLED 1025
|
||||
#define IDC_RADIO2 1028
|
||||
#define IDC_EDIT2 1029
|
||||
#define IDC_BROWSEHDD 1030
|
||||
#define IDC_EDIT3 1031
|
||||
#define IDC_BROWSEHDD2 1032
|
||||
#define IDC_CHECK1 1033
|
||||
#define IDC_CREATELINK 1033
|
||||
#define IDC_INSTHLAVNI 1035
|
||||
#define IDC_INSTALLMUSIC 1036
|
||||
#define IDC_CLIENTDESK 1036
|
||||
#define IDC_INSTALLVIDEO 1037
|
||||
#define IDC_GAMESPEEDDEFAULT 1037
|
||||
#define IDC_EXTRASHELP 1038
|
||||
#define IDC_RICHEDIT 1040
|
||||
#define IDC_CHEATPASSWORD 1041
|
||||
#define IDC_BATTLEACC 1042
|
||||
#define IDC_LIST 1044
|
||||
#define IDC_ZOOM1 1045
|
||||
#define IDC_ZOOM2 1046
|
||||
#define IDC_ZOOM3 1047
|
||||
#define IDC_MON1 1048
|
||||
#define IDC_MON2 1049
|
||||
#define IDC_MON3 1050
|
||||
#define IDC_CESTANAPLUGINY 1050
|
||||
#define IDC_PLUGLIST 1051
|
||||
#define IDC_PLUGVLASTNOSTI 1052
|
||||
#define IDC_PLUGINYNAPOVEDA 1053
|
||||
#define IDC_HODNOTA 1054
|
||||
#define IDC_EXRANDOMBACKFIRES 2000
|
||||
#define IDC_EXRESPAWNMONSTERS 2001
|
||||
#define IDC_EXALTERNATEFIGHT 2002
|
||||
#define IDC_EXRECORVERITEMS 2003
|
||||
#define IDC_EXBAGEXTENDED 2005
|
||||
#define IDC_EXSHIELDBLOCKING 2006
|
||||
#define IDC_EXFASTTRADE 2007
|
||||
#define IDC_EXALWAYSMINIMAP 2008
|
||||
#define IDC_EXGROUPFLEE 2009
|
||||
#define IDC_EXAUTOOPENBOOK 2011
|
||||
#define IDC_EXAUTOSHOWRUNE 2012
|
||||
#define IDC_EXMOBDIAGONAL 2013
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 133
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1055
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
91
Windows/richview.cpp
Normal file
91
Windows/richview.cpp
Normal file
|
@ -0,0 +1,91 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <resource.h>
|
||||
#include <richedit.h>
|
||||
#include <windowsx.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static bool IsModal=false;
|
||||
|
||||
static DWORD CALLBACK RtfViewerCallback(
|
||||
DWORD dwCookie, // application-defined value
|
||||
LPBYTE pbBuff, // pointer to a buffer
|
||||
LONG cb, // number of bytes to read or write
|
||||
LONG *pcb // pointer to number of bytes transferred
|
||||
)
|
||||
{
|
||||
char **rdptr=(char **)dwCookie;
|
||||
char *p=*rdptr;
|
||||
*pcb=0;
|
||||
while (*p && cb)
|
||||
{
|
||||
*pbBuff=*(LPBYTE)p;
|
||||
pbBuff++;
|
||||
p++;
|
||||
cb--;
|
||||
pcb[0]++;
|
||||
}
|
||||
*rdptr=p;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static LRESULT RtfViewer(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
HWND rtf=GetDlgItem(hWnd,IDC_RICHEDIT);
|
||||
EDITSTREAM edstr;
|
||||
char *rdptr=(char *)lParam;
|
||||
edstr.dwCookie=(DWORD)(&rdptr);
|
||||
edstr.pfnCallback=RtfViewerCallback;
|
||||
SendMessage(rtf,EM_STREAMIN,SF_RTF|SFF_PLAINRTF,(LPARAM)(&edstr));
|
||||
break;
|
||||
}
|
||||
case WM_COMMAND:
|
||||
if (LOWORD(wParam)==IDOK || LOWORD(wParam)==IDCANCEL)
|
||||
{
|
||||
if (IsModal) EndDialog(hWnd,LOWORD(wParam));
|
||||
else DestroyWindow(hWnd);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
default: return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
DWORD ShowRichView(HWND hWnd, const char *resourceName, const char *resourceType, bool modal)
|
||||
{
|
||||
|
||||
HMODULE mod;
|
||||
mod=GetModuleHandle("RICHED20.DLL");
|
||||
if (mod==NULL) mod=LoadLibrary("RICHED20.DLL");
|
||||
if (mod==NULL)
|
||||
{
|
||||
char buff[256];
|
||||
LoadString(GetModuleHandle(NULL),IDS_RICHEDMISSING,buff,sizeof(buff));
|
||||
MessageBox(hWnd,buff,NULL,MB_OK|MB_ICONEXCLAMATION);
|
||||
return 0;
|
||||
}
|
||||
HRSRC rsrc=FindResource(GetModuleHandle(NULL),resourceName,resourceType);
|
||||
if (rsrc==NULL) return 0;
|
||||
HGLOBAL src=LoadResource(GetModuleHandle(NULL),rsrc);
|
||||
const char *ptr=(const char *)LockResource(src);
|
||||
DWORD res=0;
|
||||
if (modal)
|
||||
{
|
||||
IsModal=true;
|
||||
res=DialogBoxParam(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_RTFVIEWER),hWnd,(DLGPROC)RtfViewer,(LPARAM)ptr);
|
||||
IsModal=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
HWND hDlg=CreateDialogParam(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_RTFVIEWER),hWnd,(DLGPROC)RtfViewer,(LPARAM)ptr);
|
||||
ShowWindow(hDlg,SW_SHOW);
|
||||
res=(DWORD)hDlg;
|
||||
}
|
||||
return res;
|
||||
}
|
1
Windows/richview.h
Normal file
1
Windows/richview.h
Normal file
|
@ -0,0 +1 @@
|
|||
DWORD ShowRichView(HWND hWnd, const char *resourceName, const char *resourceType, bool modal);
|
BIN
Windows/seladv_male.bmp
Normal file
BIN
Windows/seladv_male.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
199
Windows/skeldal_win.c
Normal file
199
Windows/skeldal_win.c
Normal file
|
@ -0,0 +1,199 @@
|
|||
#include "skeldal_win.h"
|
||||
#include "debug.h"
|
||||
#include "resource.h"
|
||||
#include <devices.h>
|
||||
|
||||
void DXMouseTransform(unsigned short *x, unsigned short *y);
|
||||
void DxLockBuffers(BOOL lock);
|
||||
|
||||
HKL english_layout=NULL;
|
||||
|
||||
#define WM_EXTRACHAR (WM_APP+100)
|
||||
|
||||
#define MAX_KEYQUEUE 16
|
||||
|
||||
#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
|
||||
#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
|
||||
|
||||
|
||||
static unsigned long keyqueue[MAX_KEYQUEUE];
|
||||
static unsigned long keyqueuelen=0;
|
||||
static char wheel_mapping[2]={'Q','I'};
|
||||
static BOOL noextra;
|
||||
MS_EVENT win_mouseEvent;
|
||||
static BOOL ActiveWindow=FALSE;
|
||||
static DWORD WaitNext=0;
|
||||
|
||||
void SetWheelMapping(char up, char down)
|
||||
{
|
||||
wheel_mapping[0]=down;
|
||||
wheel_mapping[1]=up;
|
||||
}
|
||||
|
||||
static void SetMouseEvent(MS_EVENT *event,UINT msg, WPARAM wParam,LPARAM lParam)
|
||||
{
|
||||
event->event_type=0;
|
||||
switch (msg)
|
||||
{
|
||||
case WM_LBUTTONDOWN: event->event_type=0x2;break;
|
||||
case WM_LBUTTONUP: event->event_type=0x4;break;
|
||||
case WM_RBUTTONDOWN: event->event_type=0x8;break;
|
||||
case WM_RBUTTONUP: event->event_type=0x10;break;
|
||||
case WM_MBUTTONDOWN: event->event_type=0x20;break;
|
||||
case WM_MBUTTONUP: event->event_type=0x40;break;
|
||||
case WM_MOUSEMOVE: event->event_type=0x1;break;
|
||||
}
|
||||
event->x=GET_X_LPARAM(lParam);
|
||||
event->y=GET_Y_LPARAM(lParam);
|
||||
event->tl1=(wParam & MK_LBUTTON)!=0;
|
||||
event->tl3=(wParam & MK_MBUTTON)!=0;
|
||||
event->tl2=(wParam & MK_RBUTTON)!=0;
|
||||
event->event=1;
|
||||
DXMouseTransform(&event->x,&event->y);
|
||||
}
|
||||
|
||||
LRESULT GameMainWindowWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (msg>=WM_MOUSEFIRST && msg<=WM_MOUSELAST && msg!=WM_MOUSEWHEEL)
|
||||
{
|
||||
SetMouseEvent(&win_mouseEvent,msg,wParam,lParam);
|
||||
}
|
||||
else switch (msg)
|
||||
{
|
||||
case WM_CREATE:
|
||||
if (english_layout==NULL) english_layout=LoadKeyboardLayout("00000409",KLF_ACTIVATE);
|
||||
DSReportWindowCreation(hWnd);
|
||||
return TRUE;
|
||||
case WM_ENDSESSION:
|
||||
case WM_CLOSE:
|
||||
DXCloseMode();
|
||||
exit(1);
|
||||
break;
|
||||
case WM_SETCURSOR: if (LOWORD(lParam)==HTCLIENT)SetCursor(NULL);
|
||||
else return DefWindowProc(hWnd,msg,wParam,lParam);break;
|
||||
return TRUE;
|
||||
case WM_EXTRACHAR: if (noextra) {noextra=FALSE;break; }
|
||||
case WM_CHAR:
|
||||
if (keyqueuelen<16)
|
||||
{
|
||||
memmove(keyqueue,keyqueue+1,sizeof(*keyqueue)*keyqueuelen);
|
||||
keyqueuelen++;
|
||||
keyqueue[0]=MAKEWORD(wParam,HIWORD(lParam));
|
||||
}
|
||||
if (msg==WM_CHAR) noextra=TRUE;
|
||||
break;
|
||||
case WM_MOUSEWHEEL:
|
||||
{
|
||||
short delta=HIWORD(wParam);
|
||||
if (keyqueuelen<16)
|
||||
{
|
||||
memmove(keyqueue,keyqueue+1,sizeof(*keyqueue)*keyqueuelen);
|
||||
keyqueuelen++;
|
||||
keyqueue[0]=MAKEWORD(0,delta<0?wheel_mapping[0]:wheel_mapping[1]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_ACTIVATE:
|
||||
{
|
||||
int fActive = LOWORD(wParam);
|
||||
ActiveWindow=fActive!=WA_INACTIVE;
|
||||
break;
|
||||
}
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
BeginPaint(hWnd,&ps);
|
||||
DXCopyRects64(0,0,DxGetResX(),DxGetResY());
|
||||
EndPaint(hWnd,&ps);
|
||||
break;
|
||||
}
|
||||
case WM_RELOADMAP:
|
||||
{
|
||||
char buff[256];
|
||||
int sektor=wParam;
|
||||
GlobalGetAtomName((ATOM)lParam,buff,256);
|
||||
GlobalDeleteAtom((ATOM)lParam);
|
||||
send_message(E_RELOADMAP,buff,sektor);
|
||||
break;
|
||||
}
|
||||
|
||||
default: return DefWindowProc(hWnd,msg,wParam,lParam);break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void CheckMessageQueue()
|
||||
{
|
||||
MSG msg;
|
||||
while (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
if (msg.message==WM_KEYDOWN)
|
||||
{
|
||||
PostMessage(msg.hwnd,WM_EXTRACHAR,0,msg.lParam);
|
||||
}
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
void WaitMsgQueue()
|
||||
{
|
||||
WaitMessage();
|
||||
CheckMessageQueue();
|
||||
}
|
||||
|
||||
unsigned long _bios_keybrd(int mode)
|
||||
{
|
||||
repeat:
|
||||
if (keyqueuelen)
|
||||
{
|
||||
if (mode==_KEYBRD_READY) return 1;
|
||||
if (mode==_KEYBRD_READ) {keyqueuelen--;return keyqueue[keyqueuelen];}
|
||||
}
|
||||
if (mode==_KEYBRD_READ) {WaitMsgQueue(); goto repeat;}
|
||||
CheckMessageQueue();
|
||||
return keyqueuelen!=0;
|
||||
}
|
||||
|
||||
void task_terminating()
|
||||
{
|
||||
STOP();
|
||||
}
|
||||
|
||||
void *LoadResourceFont(const char *name)
|
||||
{
|
||||
HINSTANCE hInst=GetModuleHandle(NULL);
|
||||
HRSRC rsrc=FindResource(hInst,name,"SKELDAL_FONT");
|
||||
HGLOBAL glb=LoadResource(hInst,rsrc);
|
||||
return LockResource(glb);
|
||||
}
|
||||
|
||||
void *LoadDefaultFont()
|
||||
{
|
||||
return LoadResourceFont(MAKEINTRESOURCE(IDR_BOLDCZ));
|
||||
}
|
||||
|
||||
|
||||
void ShareCPU()
|
||||
{
|
||||
DWORD curTime=GetTickCount();
|
||||
DWORD timeout=WaitNext<curTime?0:WaitNext-curTime;
|
||||
DWORD res=WAIT_TIMEOUT;
|
||||
if (WaitNext==0) WaitNext=GetTickCount();
|
||||
|
||||
DxLockBuffers(FALSE);
|
||||
if (timeout) res=MsgWaitForMultipleObjects(0,NULL,FALSE,timeout,QS_ALLINPUT);
|
||||
if (res==WAIT_TIMEOUT) WaitNext=WaitNext+10;
|
||||
DxLockBuffers(TRUE);
|
||||
}
|
||||
|
||||
char *AutodetectWinAmp()
|
||||
{
|
||||
char *cwd = getcwd(0);
|
||||
char *fullpath = (char *)malloc(strlen(cwd)+50);
|
||||
sprintf(fullpath,"%s\\Plugins",cwd);
|
||||
free(cwd);
|
||||
return fullpath;
|
||||
}
|
||||
|
50
Windows/skeldal_win.h
Normal file
50
Windows/skeldal_win.h
Normal file
|
@ -0,0 +1,50 @@
|
|||
#include <windows.h>
|
||||
|
||||
#define BGSWITCHBIT 0x0020
|
||||
|
||||
#define SKELDALINI "WSKELDAL.INI"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
#define _KEYBRD_READY 0
|
||||
#define _KEYBRD_READ 1
|
||||
|
||||
#define TIMERSPEED 20;
|
||||
|
||||
unsigned long _bios_keybrd(int mode);
|
||||
|
||||
|
||||
LRESULT GameMainWindowWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
|
||||
void CheckMessageQueue();
|
||||
|
||||
void DSReportWindowCreation(HWND hWindow);
|
||||
char *AutodetectWinAmp();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define RGB888(r,g,b) ((unsigned short)((((r)<<8)&0xF800) | (((g)<<3) & 0x7C0) | ((b)>>3)))
|
||||
#define RGB555(r,g,b) ((unsigned short)(((r)<<11) | ((g)<<6) | (b)))
|
||||
|
||||
#pragma warning (disable : 4244 4761 4133)
|
||||
|
||||
|
||||
void *LoadDefaultFont();
|
||||
void *LoadResourceFont(const char *name);
|
||||
|
||||
void ShareCPU();
|
||||
void SetWheelMapping(char up, char down);
|
||||
|
||||
|
||||
//------------- BGRAPH DX wrapper -------------------
|
||||
#include "BGraph2Dx.h"
|
||||
|
||||
#define WM_RELOADMAP (WM_APP+215)
|
||||
#define E_RELOADMAP 40
|
BIN
Windows/uvodni.bmp
Normal file
BIN
Windows/uvodni.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 301 KiB |
322
Windows/uvodni.cpp
Normal file
322
Windows/uvodni.cpp
Normal file
|
@ -0,0 +1,322 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <windowsx.h>
|
||||
#include <commctrl.h>
|
||||
#include "uvodni.h"
|
||||
#include "resource.h"
|
||||
#include "konfig.h"
|
||||
#include "install.h"
|
||||
#include <io.h>
|
||||
#include <SHLOBJ.H>
|
||||
#include "..\game\version.h"
|
||||
|
||||
|
||||
#define UVODNIOKNOCLASS "Uvodni okno hry Brany Skeldalu@bredysoft"
|
||||
#define SELPOSX 0
|
||||
#define SELPOSY 279
|
||||
|
||||
LRESULT UvodniWinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
void RegistrujTriduOkna()
|
||||
{
|
||||
WNDCLASSEX cls;
|
||||
memset(&cls,0,sizeof(cls));
|
||||
cls.cbSize=sizeof(cls);
|
||||
cls.hCursor=LoadCursor(NULL,IDC_ARROW);
|
||||
cls.hInstance=GetModuleHandle(NULL);
|
||||
cls.hIcon=LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_MAINICON));
|
||||
cls.lpfnWndProc=(WNDPROC)UvodniWinProc;
|
||||
cls.lpszClassName=UVODNIOKNOCLASS;
|
||||
if (RegisterClassEx(&cls)==NULL)
|
||||
{
|
||||
MessageBox(NULL,"Nelze registrovat tridu okna",NULL,MB_OK|MB_ICONSTOP);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
static HBITMAP pozadi;
|
||||
static HBITMAP selpozadi;
|
||||
static HDC pozadi_dc;
|
||||
static HDC selpozadi_dc;
|
||||
static HBITMAP pozadi_dc_old;
|
||||
static HBITMAP selpozadi_dc_old;
|
||||
static int exitstatus=0;
|
||||
|
||||
static int GetSelection(HWND hWnd, DWORD pt,RECT *rcout)
|
||||
{
|
||||
POINT ptt;
|
||||
BITMAP bmpi;
|
||||
ptt.x=GET_X_LPARAM(pt);
|
||||
ptt.y=GET_Y_LPARAM(pt);
|
||||
ScreenToClient(hWnd,&ptt);
|
||||
GetObject(selpozadi,sizeof(bmpi),&bmpi);
|
||||
RECT rc;
|
||||
rc.left=SELPOSX;
|
||||
rc.top=SELPOSY;
|
||||
rc.right=rc.left+bmpi.bmWidth;
|
||||
rc.bottom=rc.top+bmpi.bmHeight;
|
||||
for (int i=0;i<3;i++)
|
||||
{
|
||||
RECT rrc=rc;
|
||||
rrc.top=rc.top+((rc.bottom-rc.top)*i)/3;
|
||||
rrc.bottom=rc.top+((rc.bottom-rc.top)*(i+1))/3;
|
||||
if (PtInRect(&rrc,ptt))
|
||||
{
|
||||
if (rcout) *rcout=rrc;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void UkazSelekci(HWND hWnd, HDC hDc, DWORD pt)
|
||||
{
|
||||
RECT rc;
|
||||
int res=GetSelection(hWnd,pt,&rc);
|
||||
if (res==-1) return;
|
||||
BitBlt(hDc,rc.left,rc.top,rc.right-rc.left,rc.bottom-rc.top,selpozadi_dc,rc.left-SELPOSX,rc.top-SELPOSY,SRCCOPY);
|
||||
}
|
||||
|
||||
static HFONT vfont;
|
||||
|
||||
static void ShowVersion(HDC dc)
|
||||
{
|
||||
HFONT fnt=(HFONT )SelectObject(dc,vfont);
|
||||
char ver[200]="Version: "VERSION;
|
||||
int len=strlen(ver);
|
||||
SIZE sz;
|
||||
::GetTextExtentPoint(dc,ver,len,&sz);
|
||||
|
||||
SetTextColor(dc,RGB(255,255,255));
|
||||
SetBkMode(dc,TRANSPARENT);
|
||||
TextOut(dc,630-sz.cx,450-sz.cy,ver,len);
|
||||
SelectObject(dc,fnt);
|
||||
}
|
||||
|
||||
static LRESULT UvodniWinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static int lastsel;
|
||||
static RECT lastselrect;
|
||||
switch (msg)
|
||||
{
|
||||
case WM_CREATE:
|
||||
{
|
||||
HDC wdc=GetDC(hWnd);
|
||||
pozadi=LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_UVODNIPOZADI));
|
||||
selpozadi=LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_UVODNISELECT));
|
||||
pozadi_dc=CreateCompatibleDC(wdc);
|
||||
selpozadi_dc=CreateCompatibleDC(wdc);
|
||||
ReleaseDC(hWnd,wdc);
|
||||
pozadi_dc_old=(HBITMAP)SelectObject(pozadi_dc,pozadi);
|
||||
selpozadi_dc_old=(HBITMAP)SelectObject(selpozadi_dc,selpozadi);
|
||||
lastsel=-1;
|
||||
if (_access(SKELDALINI,06)!=0) PostMessage(hWnd,WM_APP,0,0);
|
||||
vfont=CreateFont(15,0,0,0,0,0,0,0,0,0,0,0,0,"Arial");
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC wdc=BeginPaint(hWnd,&ps);
|
||||
BitBlt(wdc,0,0,640,480,pozadi_dc,0,0,SRCCOPY);
|
||||
ShowVersion(wdc);
|
||||
UkazSelekci(hWnd,wdc,GetMessagePos());
|
||||
EndPaint(hWnd,&ps);
|
||||
}
|
||||
break;
|
||||
case WM_SETCURSOR:
|
||||
if (lastsel!=-1)
|
||||
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(32649)));
|
||||
else
|
||||
SetCursor(LoadCursor(NULL, IDC_ARROW));
|
||||
break;
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
RECT rc;
|
||||
int p=GetSelection(hWnd,GetMessagePos(),&rc);
|
||||
if (p!=lastsel)
|
||||
{
|
||||
InvalidateRect(hWnd,&rc,FALSE);
|
||||
InvalidateRect(hWnd,&lastselrect,FALSE);
|
||||
lastsel=p;
|
||||
lastselrect=rc;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_CLOSE:
|
||||
exitstatus=0;
|
||||
DestroyWindow(hWnd);
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
SelectObject(pozadi_dc,pozadi_dc_old);
|
||||
SelectObject(selpozadi_dc,selpozadi_dc_old);
|
||||
DeleteObject(pozadi);
|
||||
DeleteObject(selpozadi);
|
||||
DeleteDC(pozadi_dc);
|
||||
DeleteDC(selpozadi_dc);
|
||||
PostQuitMessage(exitstatus);
|
||||
DeleteObject(vfont);
|
||||
break;
|
||||
case WM_LBUTTONUP:
|
||||
{
|
||||
int p=GetSelection(hWnd,GetMessagePos(),NULL);
|
||||
if (p!=-1)
|
||||
{
|
||||
switch (p)
|
||||
{
|
||||
case 2: exitstatus=0; DestroyWindow(hWnd);break;
|
||||
case 0: exitstatus=1; DestroyWindow(hWnd);break;
|
||||
case 1: OpenKonfig(hWnd);break;
|
||||
// case 0: RunInstall(hWnd);break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_APP:
|
||||
if (RunInstall(hWnd)==FALSE) {exitstatus=0;DestroyWindow(hWnd);}
|
||||
break;
|
||||
default:return DefWindowProc(hWnd,msg,wParam,lParam);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
|
||||
char OtevriUvodniOkno()
|
||||
{
|
||||
RECT rc;
|
||||
|
||||
char buff[256];
|
||||
|
||||
LoadString(GetModuleHandle(NULL),IDS_WINTITLE,buff,sizeof(buff));
|
||||
|
||||
InitCommonControls();
|
||||
|
||||
RegistrujTriduOkna();
|
||||
GetClientRect(GetDesktopWindow(),&rc);
|
||||
rc.left=(rc.right-640)/2;
|
||||
rc.top=(rc.bottom-480)/2;
|
||||
|
||||
AdjustWindowRect(&rc,WS_OVERLAPPEDWINDOW,FALSE);
|
||||
|
||||
HWND hOknoWnd=CreateWindow(UVODNIOKNOCLASS,buff,WS_OVERLAPPED|WS_SYSMENU|WS_VISIBLE|WS_MINIMIZEBOX|WS_BORDER,rc.left,rc.top,640,480,NULL,NULL,GetModuleHandle(NULL),NULL);
|
||||
MSG msg;
|
||||
while (GetMessage(&msg,0,0,0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
UnregisterClass(UVODNIOKNOCLASS,GetModuleHandle(NULL));
|
||||
return msg.wParam==1;
|
||||
}
|
||||
|
||||
static void CreateAdvLink(char *advname)
|
||||
{
|
||||
char modname[MAX_PATH*4];
|
||||
char linkname[MAX_PATH*4];
|
||||
GetModuleFileName(NULL,modname,MAX_PATH*4);
|
||||
CoInitialize(NULL);
|
||||
SHGetSpecialFolderPath(NULL,linkname,CSIDL_DESKTOPDIRECTORY,TRUE);
|
||||
strcat(linkname,"\\");
|
||||
strcat(linkname,advname);
|
||||
strcat(linkname,".lnk");
|
||||
CreateLink(modname,linkname,"",advname);
|
||||
}
|
||||
|
||||
|
||||
static char selectedAdv[MAX_PATH];
|
||||
static LRESULT SelectAdventureDlg(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
char temp[MAX_PATH];
|
||||
switch (msg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
WIN32_FIND_DATA fdata;
|
||||
HANDLE fnd=FindFirstFile("*.adv",&fdata);
|
||||
selectedAdv[0]=0;
|
||||
if (fnd!=INVALID_HANDLE_VALUE)
|
||||
{
|
||||
HWND lsbx=GetDlgItem(hDlg,IDC_LIST);
|
||||
LoadString(GetModuleHandle(NULL),IDS_DEFAULTADV,temp,sizeof(temp));
|
||||
ListBox_AddString(lsbx,temp);
|
||||
do ListBox_AddString(lsbx,fdata.cFileName); while (FindNextFile(fnd,&fdata));
|
||||
FindClose(fnd);
|
||||
ListBox_SetCurSel(lsbx,0);
|
||||
EnableWindow(GetDlgItem(hDlg,IDC_CREATELINK),0);
|
||||
}
|
||||
else
|
||||
EndDialog(hDlg,IDOK);
|
||||
}
|
||||
break;
|
||||
case WM_DRAWITEM: if (wParam==IDC_LIST)
|
||||
{
|
||||
LPDRAWITEMSTRUCT drawinfo=(LPDRAWITEMSTRUCT)lParam;
|
||||
char *c;
|
||||
if (drawinfo->itemState & ODS_SELECTED)
|
||||
{
|
||||
SetTextColor(drawinfo->hDC,GetSysColor(COLOR_HIGHLIGHTTEXT));
|
||||
SetBkColor(drawinfo->hDC,GetSysColor(COLOR_HIGHLIGHT));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetTextColor(drawinfo->hDC,GetSysColor(COLOR_WINDOWTEXT));
|
||||
SetBkColor(drawinfo->hDC,GetSysColor(COLOR_WINDOW));
|
||||
}
|
||||
ListBox_GetText(drawinfo->hwndItem,drawinfo->itemID,temp);
|
||||
c=strrchr(temp,'.');
|
||||
if (c) *c=0;
|
||||
ExtTextOut(drawinfo->hDC,0,0,ETO_OPAQUE,&drawinfo->rcItem,"",0,NULL);
|
||||
DrawText(drawinfo->hDC,temp,strlen(temp),&drawinfo->rcItem,DT_SINGLELINE|DT_VCENTER|DT_CENTER|DT_NOPREFIX);
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDOK:
|
||||
{
|
||||
HWND lsbx=GetDlgItem(hDlg,IDC_LIST);
|
||||
int cursel=ListBox_GetCurSel(lsbx);
|
||||
if (cursel!=0)
|
||||
{
|
||||
ListBox_GetText(lsbx,cursel,selectedAdv);
|
||||
if (IsDlgButtonChecked(hDlg,IDC_CREATELINK) & BST_CHECKED)
|
||||
CreateAdvLink(selectedAdv);
|
||||
}
|
||||
EndDialog(hDlg,IDOK);
|
||||
}
|
||||
break;
|
||||
case IDCANCEL:
|
||||
EndDialog(hDlg,IDCANCEL);
|
||||
break;
|
||||
case IDC_LIST:
|
||||
if (HIWORD(wParam)==LBN_DBLCLK)
|
||||
PostMessage(hDlg,WM_COMMAND,IDOK,0);
|
||||
if (HIWORD(wParam)==LBN_SELCHANGE)
|
||||
EnableWindow(GetDlgItem(hDlg,IDC_CREATELINK),ListBox_GetCurSel(GetDlgItem(hDlg,IDC_LIST))!=0);
|
||||
break;
|
||||
|
||||
default:return 0;
|
||||
}
|
||||
break;
|
||||
default: return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
char SelectAdventure()
|
||||
{
|
||||
int ret=DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_SELADV), NULL, (DLGPROC)SelectAdventureDlg);
|
||||
if (ret==IDCANCEL) exit(0);
|
||||
if (selectedAdv[0]==0) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
char *GetSelectedAdventure()
|
||||
{
|
||||
return selectedAdv;
|
||||
}
|
||||
|
||||
}
|
11
Windows/uvodni.h
Normal file
11
Windows/uvodni.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
char OtevriUvodniOkno();
|
||||
char SelectAdventure();
|
||||
char *GetSelectedAdventure();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
BIN
Windows/uvodni_sel.bmp
Normal file
BIN
Windows/uvodni_sel.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 40 KiB |
1028
Windows/wa_ipc.h
Normal file
1028
Windows/wa_ipc.h
Normal file
File diff suppressed because it is too large
Load diff
103
Windows/winamp/In2.h
Normal file
103
Windows/winamp/In2.h
Normal file
|
@ -0,0 +1,103 @@
|
|||
#include "out.h"
|
||||
|
||||
// note: exported symbol is now winampGetInModule2.
|
||||
|
||||
#define IN_VER 0x100
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int version; // module type (IN_VER)
|
||||
char *description; // description of module, with version string
|
||||
|
||||
HWND hMainWindow; // winamp's main window (filled in by winamp)
|
||||
HINSTANCE hDllInstance; // DLL instance handle (Also filled in by winamp)
|
||||
|
||||
char *FileExtensions; // "mp3\0Layer 3 MPEG\0mp2\0Layer 2 MPEG\0mpg\0Layer 1 MPEG\0"
|
||||
// May be altered from Config, so the user can select what they want
|
||||
|
||||
int is_seekable; // is this stream seekable?
|
||||
int UsesOutputPlug; // does this plug-in use the output plug-ins? (musn't ever change, ever :)
|
||||
|
||||
void (*Config)(HWND hwndParent); // configuration dialog
|
||||
void (*About)(HWND hwndParent); // about dialog
|
||||
|
||||
void (*Init)(); // called at program init
|
||||
void (*Quit)(); // called at program quit
|
||||
|
||||
void (*GetFileInfo)(char *file, char *title, int *length_in_ms); // if file == NULL, current playing is used
|
||||
int (*InfoBox)(char *file, HWND hwndParent);
|
||||
|
||||
int (*IsOurFile)(char *fn); // called before extension checks, to allow detection of mms://, etc
|
||||
// playback stuff
|
||||
int (*Play)(char *fn); // return zero on success, -1 on file-not-found, some other value on other (stopping winamp) error
|
||||
void (*Pause)(); // pause stream
|
||||
void (*UnPause)(); // unpause stream
|
||||
int (*IsPaused)(); // ispaused? return 1 if paused, 0 if not
|
||||
void (*Stop)(); // stop (unload) stream
|
||||
|
||||
// time stuff
|
||||
int (*GetLength)(); // get length in ms
|
||||
int (*GetOutputTime)(); // returns current output time in ms. (usually returns outMod->GetOutputTime()
|
||||
void (*SetOutputTime)(int time_in_ms); // seeks to point in stream (in ms). Usually you signal yoru thread to seek, which seeks and calls outMod->Flush()..
|
||||
|
||||
// volume stuff
|
||||
void (*SetVolume)(int volume); // from 0 to 255.. usually just call outMod->SetVolume
|
||||
void (*SetPan)(int pan); // from -127 to 127.. usually just call outMod->SetPan
|
||||
|
||||
// in-window builtin vis stuff
|
||||
|
||||
void (*SAVSAInit)(int maxlatency_in_ms, int srate); // call once in Play(). maxlatency_in_ms should be the value returned from outMod->Open()
|
||||
// call after opening audio device with max latency in ms and samplerate
|
||||
void (*SAVSADeInit)(); // call in Stop()
|
||||
|
||||
|
||||
// simple vis supplying mode
|
||||
void (*SAAddPCMData)(void *PCMData, int nch, int bps, int timestamp);
|
||||
// sets the spec data directly from PCM data
|
||||
// quick and easy way to get vis working :)
|
||||
// needs at least 576 samples :)
|
||||
|
||||
// advanced vis supplying mode, only use if you're cool. Use SAAddPCMData for most stuff.
|
||||
int (*SAGetMode)(); // gets csa (the current type (4=ws,2=osc,1=spec))
|
||||
// use when calling SAAdd()
|
||||
void (*SAAdd)(void *data, int timestamp, int csa); // sets the spec data, filled in by winamp
|
||||
|
||||
|
||||
// vis stuff (plug-in)
|
||||
// simple vis supplying mode
|
||||
void (*VSAAddPCMData)(void *PCMData, int nch, int bps, int timestamp); // sets the vis data directly from PCM data
|
||||
// quick and easy way to get vis working :)
|
||||
// needs at least 576 samples :)
|
||||
|
||||
// advanced vis supplying mode, only use if you're cool. Use VSAAddPCMData for most stuff.
|
||||
int (*VSAGetMode)(int *specNch, int *waveNch); // use to figure out what to give to VSAAdd
|
||||
void (*VSAAdd)(void *data, int timestamp); // filled in by winamp, called by plug-in
|
||||
|
||||
|
||||
// call this in Play() to tell the vis plug-ins the current output params.
|
||||
void (*VSASetInfo)(int nch, int srate);
|
||||
|
||||
|
||||
// dsp plug-in processing:
|
||||
// (filled in by winamp, called by input plug)
|
||||
|
||||
// returns 1 if active (which means that the number of samples returned by dsp_dosamples
|
||||
// could be greater than went in.. Use it to estimate if you'll have enough room in the
|
||||
// output buffer
|
||||
int (*dsp_isactive)();
|
||||
|
||||
// returns number of samples to output. This can be as much as twice numsamples.
|
||||
// be sure to allocate enough buffer for samples, then.
|
||||
int (*dsp_dosamples)(short int *samples, int numsamples, int bps, int nch, int srate);
|
||||
|
||||
|
||||
// eq stuff
|
||||
void (*EQSet)(int on, char data[10], int preamp); // 0-64 each, 31 is +0, 0 is +12, 63 is -12. Do nothing to ignore.
|
||||
|
||||
// info setting (filled in by winamp)
|
||||
void (*SetInfo)(int bitrate, int srate, int stereo, int synched); // if -1, changes ignored? :)
|
||||
|
||||
Out_Module *outMod; // filled in by winamp, optionally used :)
|
||||
} In_Module;
|
||||
|
||||
|
62
Windows/winamp/Out.h
Normal file
62
Windows/winamp/Out.h
Normal file
|
@ -0,0 +1,62 @@
|
|||
|
||||
// ids:
|
||||
// waveout: 32
|
||||
// gapless: 64
|
||||
// xfade: 63
|
||||
// disk: 33
|
||||
// dsound: 38
|
||||
// NULL: 65
|
||||
// mm2: 69
|
||||
|
||||
#define OUT_VER 0x10
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int version; // module version (OUT_VER)
|
||||
char *description; // description of module, with version string
|
||||
int id; // module id. each input module gets its own. non-nullsoft modules should
|
||||
// be >= 65536.
|
||||
|
||||
HWND hMainWindow; // winamp's main window (filled in by winamp)
|
||||
HINSTANCE hDllInstance; // DLL instance handle (filled in by winamp)
|
||||
|
||||
void (*Config)(HWND hwndParent); // configuration dialog
|
||||
void (*About)(HWND hwndParent); // about dialog
|
||||
|
||||
void (*Init)(); // called when loaded
|
||||
void (*Quit)(); // called when unloaded
|
||||
|
||||
int (*Open)(int samplerate, int numchannels, int bitspersamp, int bufferlenms, int prebufferms);
|
||||
// returns >=0 on success, <0 on failure
|
||||
// NOTENOTENOTE: bufferlenms and prebufferms are ignored in most if not all output plug-ins.
|
||||
// ... so don't expect the max latency returned to be what you asked for.
|
||||
// returns max latency in ms (0 for diskwriters, etc)
|
||||
// bufferlenms and prebufferms must be in ms. 0 to use defaults.
|
||||
// prebufferms must be <= bufferlenms
|
||||
|
||||
void (*Close)(); // close the ol' output device.
|
||||
|
||||
int (*Write)(char *buf, int len);
|
||||
// 0 on success. Len == bytes to write (<= 8192 always). buf is straight audio data.
|
||||
// 1 returns not able to write (yet). Non-blocking, always.
|
||||
|
||||
int (*CanWrite)(); // returns number of bytes possible to write at a given time.
|
||||
// Never will decrease unless you call Write (or Close, heh)
|
||||
|
||||
int (*IsPlaying)(); // non0 if output is still going or if data in buffers waiting to be
|
||||
// written (i.e. closing while IsPlaying() returns 1 would truncate the song
|
||||
|
||||
int (*Pause)(int pause); // returns previous pause state
|
||||
|
||||
void (*SetVolume)(int volume); // volume is 0-255
|
||||
void (*SetPan)(int pan); // pan is -128 to 128
|
||||
|
||||
void (*Flush)(int t); // flushes buffers and restarts output at time t (in ms)
|
||||
// (used for seeking)
|
||||
|
||||
int (*GetOutputTime)(); // returns played time in MS
|
||||
int (*GetWrittenTime)(); // returns time written in MS (used for synching up vis stuff)
|
||||
|
||||
} Out_Module;
|
||||
|
||||
|
95
Windows/zvuk_win.cpp
Normal file
95
Windows/zvuk_win.cpp
Normal file
|
@ -0,0 +1,95 @@
|
|||
#include <skeldal_win.h>
|
||||
#include <zvuk.h>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
int mix_back_sound(int synchro)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int get_timer_value()
|
||||
{
|
||||
return GetTickCount()/TIMERSPEED;
|
||||
}
|
||||
|
||||
|
||||
int get_snd_effect(int funct)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
char set_snd_effect(int funct,int data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
char check_snd_effect(int funct)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void change_music(char *filename)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void set_backsnd_freq(int freq)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void fade_music()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void set_mixing_device(int mix_dev,int mix_freq,...)
|
||||
{
|
||||
}
|
||||
char start_mixing()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
void stop_mixing()
|
||||
{
|
||||
}
|
||||
void play_sample(int channel,void *sample,long size,long lstart,long sfreq,int type)
|
||||
{
|
||||
}
|
||||
void set_channel_volume(int channel,int left,int right)
|
||||
{
|
||||
}
|
||||
int open_backsound(char *filename)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
char *device_name(int device)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
void force_music_volume(int volume)
|
||||
{
|
||||
}
|
||||
char get_channel_state(int channel)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
void get_channel_volume(int channel,int *left,int *right)
|
||||
{
|
||||
}
|
||||
void mute_channel(int channel)
|
||||
{
|
||||
}
|
||||
void chan_break_loop(int channel)
|
||||
{
|
||||
}
|
||||
void chan_break_ext(int channel,void *org_sample,long size_sample) //zrusi loop s moznosti dohrat zvuk
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue