mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-11 18:41:14 +00:00
Fix game startup bits (#102)
This commit is contained in:
parent
c8b1e507c7
commit
9b8bbc3e76
@ -97,7 +97,7 @@ MxResult LegoModelPresenter::CreateROI(MxDSChunk* p_chunk)
|
|||||||
SDL_strlwr(textureName);
|
SDL_strlwr(textureName);
|
||||||
|
|
||||||
if (textureName[0] == '^') {
|
if (textureName[0] == '^') {
|
||||||
strcpy(textureName, textureName + 1);
|
memmove(textureName, textureName + 1, strlen(textureName));
|
||||||
|
|
||||||
if (g_modelPresenterConfig) {
|
if (g_modelPresenterConfig) {
|
||||||
texture = new LegoTexture();
|
texture = new LegoTexture();
|
||||||
|
|||||||
@ -197,7 +197,7 @@ struct Direct3DRMMeshImpl : public Direct3DRMObjectBase<IDirect3DRMMesh> {
|
|||||||
{
|
{
|
||||||
if (SDL_memcmp(&iid, &IID_IDirect3DRMMesh, sizeof(GUID)) == 0) {
|
if (SDL_memcmp(&iid, &IID_IDirect3DRMMesh, sizeof(GUID)) == 0) {
|
||||||
*object = static_cast<IDirect3DRMMesh*>(new Direct3DRMMeshImpl);
|
*object = static_cast<IDirect3DRMMesh*>(new Direct3DRMMeshImpl);
|
||||||
return S_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DDERR_GENERIC;
|
return DDERR_GENERIC;
|
||||||
@ -206,8 +206,7 @@ struct Direct3DRMMeshImpl : public Direct3DRMObjectBase<IDirect3DRMMesh> {
|
|||||||
HRESULT AddGroup(int vertexCount, int faceCount, int vertexPerFace, void* faceBuffer, D3DRMGROUPINDEX* groupIndex)
|
HRESULT AddGroup(int vertexCount, int faceCount, int vertexPerFace, void* faceBuffer, D3DRMGROUPINDEX* groupIndex)
|
||||||
override
|
override
|
||||||
{
|
{
|
||||||
assert(false && "Unimplemented");
|
return DD_OK;
|
||||||
return DDERR_GENERIC;
|
|
||||||
}
|
}
|
||||||
HRESULT GetGroup(
|
HRESULT GetGroup(
|
||||||
int groupIndex,
|
int groupIndex,
|
||||||
@ -236,6 +235,7 @@ struct Direct3DRMMeshImpl : public Direct3DRMObjectBase<IDirect3DRMMesh> {
|
|||||||
if (!m_groupTexture) {
|
if (!m_groupTexture) {
|
||||||
return DDERR_GENERIC;
|
return DDERR_GENERIC;
|
||||||
}
|
}
|
||||||
|
m_groupTexture->AddRef();
|
||||||
*texture = m_groupTexture;
|
*texture = m_groupTexture;
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
@ -249,6 +249,16 @@ struct Direct3DRMMeshImpl : public Direct3DRMObjectBase<IDirect3DRMMesh> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Direct3DRMTextureImpl : public Direct3DRMObjectBase<IDirect3DRMTexture2> {
|
struct Direct3DRMTextureImpl : public Direct3DRMObjectBase<IDirect3DRMTexture2> {
|
||||||
|
HRESULT QueryInterface(const GUID& riid, void** ppvObject) override
|
||||||
|
{
|
||||||
|
if (SDL_memcmp(&riid, &IID_IDirect3DRMTexture2, sizeof(GUID)) == 0) {
|
||||||
|
this->IUnknown::AddRef();
|
||||||
|
*ppvObject = static_cast<IDirect3DRMTexture2*>(this);
|
||||||
|
return DD_OK;
|
||||||
|
}
|
||||||
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Direct3DRMTextureImpl does not implement guid");
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
HRESULT Clone(void** ppObject) override
|
HRESULT Clone(void** ppObject) override
|
||||||
{
|
{
|
||||||
*ppObject = static_cast<void*>(new Direct3DRMTextureImpl);
|
*ppObject = static_cast<void*>(new Direct3DRMTextureImpl);
|
||||||
@ -440,7 +450,7 @@ struct Direct3DRMImpl : virtual public IDirect3DRM2 {
|
|||||||
if (SDL_memcmp(&riid, &IID_IDirect3DRM2, sizeof(GUID)) == 0) {
|
if (SDL_memcmp(&riid, &IID_IDirect3DRM2, sizeof(GUID)) == 0) {
|
||||||
this->IUnknown::AddRef();
|
this->IUnknown::AddRef();
|
||||||
*ppvObject = static_cast<IDirect3DRM2*>(this);
|
*ppvObject = static_cast<IDirect3DRM2*>(this);
|
||||||
return S_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "DirectDrawImpl does not implement guid");
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "DirectDrawImpl does not implement guid");
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
@ -450,7 +460,7 @@ struct Direct3DRMImpl : virtual public IDirect3DRM2 {
|
|||||||
override
|
override
|
||||||
{
|
{
|
||||||
*outDevice = static_cast<IDirect3DRMDevice2*>(new Direct3DRMDevice2Impl);
|
*outDevice = static_cast<IDirect3DRMDevice2*>(new Direct3DRMDevice2Impl);
|
||||||
return S_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
HRESULT CreateDeviceFromSurface(
|
HRESULT CreateDeviceFromSurface(
|
||||||
const GUID* guid,
|
const GUID* guid,
|
||||||
@ -460,17 +470,17 @@ struct Direct3DRMImpl : virtual public IDirect3DRM2 {
|
|||||||
) override
|
) override
|
||||||
{
|
{
|
||||||
*outDevice = static_cast<IDirect3DRMDevice2*>(new Direct3DRMDevice2Impl);
|
*outDevice = static_cast<IDirect3DRMDevice2*>(new Direct3DRMDevice2Impl);
|
||||||
return S_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
HRESULT CreateTexture(D3DRMIMAGE* image, IDirect3DRMTexture2** outTexture) override
|
HRESULT CreateTexture(D3DRMIMAGE* image, IDirect3DRMTexture2** outTexture) override
|
||||||
{
|
{
|
||||||
*outTexture = static_cast<IDirect3DRMTexture2*>(new Direct3DRMTextureImpl);
|
*outTexture = static_cast<IDirect3DRMTexture2*>(new Direct3DRMTextureImpl);
|
||||||
return S_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
HRESULT CreateTextureFromSurface(LPDIRECTDRAWSURFACE surface, IDirect3DRMTexture2** outTexture) override
|
HRESULT CreateTextureFromSurface(LPDIRECTDRAWSURFACE surface, IDirect3DRMTexture2** outTexture) override
|
||||||
{
|
{
|
||||||
*outTexture = static_cast<IDirect3DRMTexture2*>(new Direct3DRMTextureImpl);
|
*outTexture = static_cast<IDirect3DRMTexture2*>(new Direct3DRMTextureImpl);
|
||||||
return S_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
HRESULT CreateMesh(IDirect3DRMMesh** outMesh) override
|
HRESULT CreateMesh(IDirect3DRMMesh** outMesh) override
|
||||||
{
|
{
|
||||||
|
|||||||
@ -54,9 +54,21 @@ HRESULT DirectDrawSurfaceImpl::Blt(
|
|||||||
if (!renderer) {
|
if (!renderer) {
|
||||||
return DDERR_GENERIC;
|
return DDERR_GENERIC;
|
||||||
}
|
}
|
||||||
SDL_FRect srcRect = ConvertRect(lpSrcRect);
|
auto srcSurface = static_cast<DirectDrawSurfaceImpl*>(lpDDSrcSurface);
|
||||||
SDL_FRect dstRect = ConvertRect(lpDestRect);
|
SDL_FRect srcRect, dstRect;
|
||||||
SDL_RenderTexture(renderer, static_cast<DirectDrawSurfaceImpl*>(lpDDSrcSurface)->m_texture, &srcRect, &dstRect);
|
if (lpSrcRect) {
|
||||||
|
srcRect = ConvertRect(lpSrcRect);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
srcRect = {0, 0, (float) srcSurface->m_texture->w, (float) srcSurface->m_texture->h};
|
||||||
|
}
|
||||||
|
if (lpDestRect) {
|
||||||
|
dstRect = ConvertRect(lpDestRect);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dstRect = {0, 0, (float) m_texture->w, (float) m_texture->h};
|
||||||
|
}
|
||||||
|
SDL_RenderTexture(renderer, srcSurface->m_texture, &srcRect, &dstRect);
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
@ -72,14 +84,16 @@ HRESULT DirectDrawSurfaceImpl::BltFast(
|
|||||||
if (!renderer) {
|
if (!renderer) {
|
||||||
return DDERR_GENERIC;
|
return DDERR_GENERIC;
|
||||||
}
|
}
|
||||||
SDL_FRect dstRect = {
|
auto srcSurface = static_cast<DirectDrawSurfaceImpl*>(lpDDSrcSurface);
|
||||||
(float) dwX,
|
SDL_FRect srcRect;
|
||||||
(float) dwY,
|
if (lpSrcRect) {
|
||||||
(float) (lpSrcRect->right - lpSrcRect->left),
|
srcRect = ConvertRect(lpSrcRect);
|
||||||
(float) (lpSrcRect->bottom - lpSrcRect->top)
|
}
|
||||||
};
|
else {
|
||||||
SDL_FRect srcRect = ConvertRect(lpSrcRect);
|
srcRect = {0, 0, (float) srcSurface->m_texture->w, (float) srcSurface->m_texture->h};
|
||||||
SDL_RenderTexture(renderer, static_cast<DirectDrawSurfaceImpl*>(lpDDSrcSurface)->m_texture, &srcRect, &dstRect);
|
}
|
||||||
|
SDL_FRect dstRect = {(float) dwX, (float) dwY, srcRect.w, srcRect.h};
|
||||||
|
SDL_RenderTexture(renderer, srcSurface->m_texture, &srcRect, &dstRect);
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
@ -90,8 +104,7 @@ HRESULT DirectDrawSurfaceImpl::Flip(LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverrid
|
|||||||
return DDERR_GENERIC;
|
return DDERR_GENERIC;
|
||||||
}
|
}
|
||||||
float width, height;
|
float width, height;
|
||||||
SDL_GetTextureSize(m_texture, &width, &height);
|
SDL_FRect rect{0, 0, (float) m_texture->w, (float) m_texture->h};
|
||||||
SDL_FRect rect{0, 0, width, height};
|
|
||||||
SDL_RenderTexture(renderer, m_texture, &rect, &rect);
|
SDL_RenderTexture(renderer, m_texture, &rect, &rect);
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user