Commit 804d6a71 authored by Gerhard Stein's avatar Gerhard Stein

Pointer fixes

parent 76b6e4dc
Subproject commit 85eb8971f07c2c74bfe124ae555004ff8b27bb18
Subproject commit c9b9eafb3809223f7039782efe5ddc0b68c408a5
include_directories(${SDL_INCLUDE_DIR})
FILE(GLOB SRCS *.cpp *.h)
set(CXXSRC
CDlgFrame.cpp
CDlgOptionText.cpp
CMessageBox.cpp
CTextViewer.cpp)
set(HSRC
CDlgFrame.h
CDlgOptionText.h
CMessageBox.h
CTextViewer.h)
add_library(cg_dialog ${CXXSRC} ${HSRC})
add_library(dialog OBJECT ${SRCS})
set_property(GLOBAL APPEND PROPERTY CG_OBJ_LIBS $<TARGET_OBJECTS:dialog>)
......@@ -25,5 +25,5 @@ set(HSRC CGameLauncher.h
add_library(engine ${CXXSRC}
${HSRC})
target_link_libraries(engine refkeen engine_keen engine_core unzip GsKit)
target_link_libraries(engine refkeen engine_keen engine_core unzip GsKit cg_dialog)
......@@ -71,10 +71,12 @@ void CHUD::setup(const int id)
mRenderRect.w = mHUDBox.getWidth()-7;
mRenderRect.x += (mRenderRect.w-2)*id;
auto HUDBoxSfc = mHUDBox.smartSDLSurface();
#if SDL_VERSION_ATLEAST(2, 0, 0)
SDL_SetSurfaceBlendMode(mHUDBox.getSDLSurface(), SDL_BLENDMODE_NONE);
SDL_SetSurfaceBlendMode(HUDBoxSfc.get(), SDL_BLENDMODE_NONE);
#else
SDL_SetAlpha(mHUDBox.getSDLSurface(), 0, 0);
SDL_SetAlpha(HUDBoxSfc.get(), 0, 0);
#endif
createHUDBlit();
......@@ -107,7 +109,8 @@ void CHUD::CreateVorticonBackground()
mKeenHeadSprite = gGraphics.getSprite(mId,PMAPDOWNFRAME);
SDL_Surface *keenHeadSfc = mKeenHeadSprite.getSDLSurface();
auto keenHeadSmartSfc = mKeenHeadSprite.smartSDLSurface();
SDL_Surface *keenHeadSfc = keenHeadSmartSfc.get();
#if SDL_VERSION_ATLEAST(2, 0, 0)
SDL_SetSurfaceBlendMode( keenHeadSfc, SDL_BLENDMODE_NONE);
......@@ -131,7 +134,8 @@ void CHUD::CreateVorticonBackground()
headdstrect.x = 45-(headsrGsRect.w/2);
headdstrect.y = 19-(headsrGsRect.h/2);
SDL_Surface *keenGunSfc = mKeenGunSprite.getSDLSurface();
auto keenGunSmartSfc = mKeenGunSprite.smartSDLSurface();
SDL_Surface *keenGunSfc = keenGunSmartSfc.get();
#if SDL_VERSION_ATLEAST(2, 0, 0)
SDL_SetSurfaceBlendMode(keenGunSfc, SDL_BLENDMODE_NONE);
......
......@@ -83,19 +83,33 @@ void getSlopePointsLowerTile(signed char slope, int &yb1, int &yb2)
{
// Calculate the corner y coordinates
if( slope == 2 )
yb1 = 0, yb2 = 256;
{
yb1 = 0; yb2 = 256;
}
else if( slope == 3 )
yb1 = 256, yb2 = 512;
{
yb1 = 256; yb2 = 512;
}
else if( slope == 4 )
yb1 = 0, yb2 = 512;
{
yb1 = 0; yb2 = 512;
}
else if( slope == 5 )
yb1 = 256, yb2 = 0;
{
yb1 = 256; yb2 = 0;
}
else if( slope == 6 )
yb1 = 512, yb2 = 256;
{
yb1 = 512; yb2 = 256;
}
else if( slope == 7 )
yb1 = 512, yb2 = 0;
{
yb1 = 512; yb2 = 0;
}
else
yb1 = 0, yb2 = 0;
{
yb1 = 0; yb2 = 0;
}
}
/**
......
......@@ -1332,7 +1332,8 @@ bool CEGAGraphicsGalaxy::readSprites( const size_t numSprites,
sprite.createSurface( gVideoDriver.mpVideoEngine->getBlitSurface()->flags,
gGraphics.Palette.m_Palette );
SDL_Surface *sfc = sprite.getSDLSurface();
auto smartSfc = sprite.smartSDLSurface();
SDL_Surface *sfc = smartSfc.get();
SDL_FillRect(sfc, nullptr, 0);
if(SDL_MUSTLOCK(sfc)) SDL_LockSurface(sfc);
......
......@@ -154,7 +154,8 @@ bool CEGASprit::loadData(const std::string& filename, bool compresseddata)
{
for(int s=0 ; s<m_numsprites ; s++)
{
sfc = gGraphics.getSprite(0,s).getSDLSurface();
auto smartSfc = gGraphics.getSprite(0,s).smartSDLSurface();
sfc = smartSfc.get();
if(SDL_MUSTLOCK(sfc)) SDL_LockSurface(sfc);
pixel = (Uint8*) sfc->pixels;
......@@ -173,13 +174,16 @@ bool CEGASprit::loadData(const std::string& filename, bool compresseddata)
// note that we invert the mask because our graphics functions
// use white on black masks whereas keen uses black on white.
for(int s=0 ; s<m_numsprites ; s++)
{
GsSprite &Sprite = gGraphics.getSprite(0,s);
SDL_Surface *pixsfc = Sprite.getSDLSurface();
SDL_Surface *masksfc = Sprite.getSDLMaskSurface();
{
GsSprite &sprite = gGraphics.getSprite(0,s);
auto smartSfc = sprite.smartSDLSurface();
auto masksfc = sprite.smartSDLMaskSurface();
SDL_Surface *pixsfc = smartSfc.get();
if(SDL_MUSTLOCK(pixsfc)) SDL_LockSurface(pixsfc);
if(SDL_MUSTLOCK(masksfc)) SDL_LockSurface(masksfc);
if(SDL_MUSTLOCK(masksfc.get())) SDL_LockSurface(masksfc.get());
pixel = (Uint8*) masksfc->pixels;
......@@ -193,7 +197,7 @@ bool CEGASprit::loadData(const std::string& filename, bool compresseddata)
pixel[y*masksfc->w + x] = 15;
}
}
if(SDL_MUSTLOCK(masksfc)) SDL_UnlockSurface(masksfc);
if(SDL_MUSTLOCK(masksfc.get())) SDL_UnlockSurface(masksfc.get());
if(SDL_MUSTLOCK(pixsfc)) SDL_UnlockSurface(pixsfc);
percent = (s*100)/m_numsprites;
......@@ -431,9 +435,10 @@ void CEGASprit::CreateYellowSpriteofTile( GsTilemap &tilemap, Uint16 tile, GsSpr
gGraphics.Palette.m_Palette );
sprite.optimizeSurface();
SDL_Surface *src_sfc = sprite.getSDLSurface();
auto smartSrcSfc = sprite.smartSDLSurface();
SDL_Surface *src_sfc = smartSrcSfc.get();
BlitSurface(tilemap.getSDLSurface(), &tile_rect, src_sfc, NULL);
BlitSurface(tilemap.getSDLSurface(), &tile_rect, src_sfc, nullptr);
if(SDL_MUSTLOCK(src_sfc)) SDL_LockSurface(src_sfc);
......
......@@ -124,7 +124,7 @@ void CGuardRobot::process()
if (onscreen)
playSound(SOUND_TANK_FIRE);
if (movedir==RIGHT)
newobject = new CRay(mpMap,getXRightPos()+(8<<STC), getYUpPos()+(5<<STC), RIGHT, CENTER, getSpriteVariantId());
newobject = new CRay(mpMap,getXRightPos()+(4<<STC), getYUpPos()+(5<<STC), RIGHT, CENTER, getSpriteVariantId());
else
newobject = new CRay(mpMap,getXPosition(), getYUpPos()+(5<<STC), LEFT, CENTER, getSpriteVariantId());
newobject->setOwner(OBJ_GUARDROBOT, m_index);
......
......@@ -275,12 +275,16 @@ void CVorticon::process()
if(!mpMap->m_Dark)
{
if (dist_traveled < VORT_TRAPPED_DIST && !mpMap->m_Dark && blockedd
&& !blockedu) {
if (dist_traveled < VORT_TRAPPED_DIST &&
blockedd &&
!blockedu)
{
initiateJump();
if (rnd() & 1) {
if (rnd() & 1)
{
yinertia = -VORT_MAX_JUMP_HEIGHT;
} else {
} else
{
yinertia = -VORT_MIN_JUMP_HEIGHT;
}
goto vort_reprocess;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment