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