Permalink
Browse files

Merge branch 'sprites'

  • Loading branch information...
2 parents 071c7bf + 75192d5 commit 04f514893516fe8b5f719594ea0e07ed0793f26e @bradallred bradallred committed Jul 5, 2013
Showing with 912 additions and 696 deletions.
  1. +21 −5 apple/GemRB.xcodeproj/project.pbxproj
  2. +3 −5 gemrb/core/Animation.cpp
  3. +3 −8 gemrb/core/AnimationFactory.cpp
  4. +0 −1 gemrb/core/CharAnimations.cpp
  5. +0 −2 gemrb/core/ControlAnimation.cpp
  6. +3 −2 gemrb/core/GUI/GameControl.cpp
  7. +1 −2 gemrb/core/ImageFactory.cpp
  8. +2 −3 gemrb/core/ImageMgr.cpp
  9. +12 −8 gemrb/core/Interface.cpp
  10. +0 −1 gemrb/core/Interface.h
  11. +0 −1 gemrb/core/SaveGameIterator.cpp
  12. +0 −1 gemrb/core/Scriptable/Door.cpp
  13. +0 −1 gemrb/core/Scriptable/InfoPoint.cpp
  14. +28 −70 gemrb/core/Sprite2D.cpp
  15. +27 −26 gemrb/core/Sprite2D.h
  16. +178 −0 gemrb/core/Video.cpp
  17. +13 −26 gemrb/core/Video.h
  18. +0 −1 gemrb/plugins/AREImporter/AREImporter.cpp
  19. +1 −1 gemrb/plugins/BAMImporter/BAMFont.cpp
  20. +11 −10 gemrb/plugins/BAMImporter/BAMImporter.cpp
  21. +115 −0 gemrb/plugins/BAMImporter/BAMSprite2D.cpp
  22. +57 −0 gemrb/plugins/BAMImporter/BAMSprite2D.h
  23. +1 −1 gemrb/plugins/BAMImporter/CMakeLists.txt
  24. +2 −2 gemrb/plugins/BMPImporter/BMPImporter.cpp
  25. +1 −1 gemrb/plugins/GUIScript/GUIScript.cpp
  26. +1 −2 gemrb/plugins/PNGImporter/PNGImporter.cpp
  27. +1 −1 gemrb/plugins/SDLVideo/CMakeLists.txt
  28. +5 −36 gemrb/plugins/SDLVideo/SDL12Video.cpp
  29. +0 −1 gemrb/plugins/SDLVideo/SDL12Video.h
  30. +0 −5 gemrb/plugins/SDLVideo/SDL20Video.cpp
  31. +0 −1 gemrb/plugins/SDLVideo/SDL20Video.h
  32. +183 −0 gemrb/plugins/SDLVideo/SDLSurfaceSprite2D.cpp
  33. +59 −0 gemrb/plugins/SDLVideo/SDLSurfaceSprite2D.h
  34. +168 −436 gemrb/plugins/SDLVideo/SDLVideo.cpp
  35. +9 −23 gemrb/plugins/SDLVideo/SDLVideo.h
  36. +1 −7 gemrb/plugins/SDLVideo/SpriteRenderer.inl
  37. +2 −2 gemrb/plugins/TISImporter/TISImporter.cpp
  38. +4 −4 gemrb/plugins/TTFImporter/TTFFont.cpp
@@ -664,6 +664,10 @@
A2E9967814DE05590052BABE /* ZLibManager.so in CopyFiles */ = {isa = PBXBuildFile; fileRef = A276B4AF13A28AEE00D41A8A /* ZLibManager.so */; };
A2E9967914DE05590052BABE /* STOImporter.so in CopyFiles */ = {isa = PBXBuildFile; fileRef = A276B4F413A28C0400D41A8A /* STOImporter.so */; };
A2E9967A14DE05590052BABE /* SAVImporter.so in CopyFiles */ = {isa = PBXBuildFile; fileRef = A2F0505113ABB80B0023B7EB /* SAVImporter.so */; };
+ A2EC2F90176BD28E00FD960E /* BAMSprite2D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2EC2F8E176BD28E00FD960E /* BAMSprite2D.cpp */; };
+ A2EC2F91176BD28E00FD960E /* BAMSprite2D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2EC2F8E176BD28E00FD960E /* BAMSprite2D.cpp */; };
+ A2EC2F94176BD44C00FD960E /* SDLSurfaceSprite2D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2EC2F92176BD44C00FD960E /* SDLSurfaceSprite2D.cpp */; };
+ A2EC2F95176BD44D00FD960E /* SDLSurfaceSprite2D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2EC2F92176BD44C00FD960E /* SDLSurfaceSprite2D.cpp */; };
A2EC8059145F9E6E0033754A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2EC8058145F9E6E0033754A /* Foundation.framework */; };
A2EC805B1460556B0033754A /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2EC805A1460556B0033754A /* OpenAL.framework */; };
A2EC805D1460559C0033754A /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2EC805C1460559C0033754A /* CoreAudio.framework */; };
@@ -1661,6 +1665,10 @@
A2E27EF616EEA7B00079E104 /* InterfaceConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InterfaceConfig.h; sourceTree = "<group>"; };
A2E27EFB16F12B5A0079E104 /* GemRB.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = GemRB.xib; path = CocoaWrapper/mac/nibs/GemRB.xib; sourceTree = "<group>"; };
A2E6646F139E8DFA00310FC8 /* libgemrb_core.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libgemrb_core.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ A2EC2F8E176BD28E00FD960E /* BAMSprite2D.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BAMSprite2D.cpp; sourceTree = "<group>"; };
+ A2EC2F8F176BD28E00FD960E /* BAMSprite2D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BAMSprite2D.h; sourceTree = "<group>"; };
+ A2EC2F92176BD44C00FD960E /* SDLSurfaceSprite2D.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SDLSurfaceSprite2D.cpp; sourceTree = "<group>"; };
+ A2EC2F93176BD44C00FD960E /* SDLSurfaceSprite2D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLSurfaceSprite2D.h; sourceTree = "<group>"; };
A2EC8058145F9E6E0033754A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
A2EC805A1460556B0033754A /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/OpenAL.framework; sourceTree = DEVELOPER_DIR; };
A2EC805C1460559C0033754A /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/CoreAudio.framework; sourceTree = DEVELOPER_DIR; };
@@ -2358,6 +2366,8 @@
A28D24A3143C24E500A27897 /* BAMFontManager.h */,
A27B86AD139F0A7D0002DC13 /* BAMImporter.cpp */,
A27B86AE139F0A7D0002DC13 /* BAMImporter.h */,
+ A2EC2F8E176BD28E00FD960E /* BAMSprite2D.cpp */,
+ A2EC2F8F176BD28E00FD960E /* BAMSprite2D.h */,
);
path = BAMImporter;
sourceTree = "<group>";
@@ -2641,15 +2651,17 @@
A27B8757139F0A7D0002DC13 /* SDLVideo */ = {
isa = PBXGroup;
children = (
- A2DB6D5715D9ECB300D70E88 /* SpriteRenderer.inl */,
- A2DB6D5815D9ECB300D70E88 /* TileRenderer.inl */,
- A298DD1714EB4EEB00F59F56 /* SDL20Video.cpp */,
- A298DD1814EB4EEB00F59F56 /* SDL20Video.h */,
+ A249187B141075A60038B170 /* CocoaWrapper.m */,
A298DD1314EB4EDE00F59F56 /* SDL12Video.cpp */,
A298DD1414EB4EDE00F59F56 /* SDL12Video.h */,
- A249187B141075A60038B170 /* CocoaWrapper.m */,
+ A298DD1714EB4EEB00F59F56 /* SDL20Video.cpp */,
+ A298DD1814EB4EEB00F59F56 /* SDL20Video.h */,
+ A2EC2F92176BD44C00FD960E /* SDLSurfaceSprite2D.cpp */,
+ A2EC2F93176BD44C00FD960E /* SDLSurfaceSprite2D.h */,
A27B875A139F0A7D0002DC13 /* SDLVideo.cpp */,
A27B875B139F0A7D0002DC13 /* SDLVideo.h */,
+ A2DB6D5715D9ECB300D70E88 /* SpriteRenderer.inl */,
+ A2DB6D5815D9ECB300D70E88 /* TileRenderer.inl */,
);
path = SDLVideo;
sourceTree = "<group>";
@@ -4597,6 +4609,7 @@
A22693791422934E004468E8 /* CocoaWrapper.m in Sources */,
A276B4EF13A28BE100D41A8A /* SDLVideo.cpp in Sources */,
A298DD1614EB4EDE00F59F56 /* SDL12Video.cpp in Sources */,
+ A2EC2F95176BD44D00FD960E /* SDLSurfaceSprite2D.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -4700,6 +4713,7 @@
A2B0CCD61486FF780074E54B /* BAMFontManager.cpp in Sources */,
A29BF82B13A03DFC00C812DD /* BAMImporter.cpp in Sources */,
A2A2EA3016A5EB4C0092B903 /* BAMFont.cpp in Sources */,
+ A2EC2F91176BD28E00FD960E /* BAMSprite2D.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -4902,6 +4916,8 @@
A2A2EA2F16A5EB4C0092B903 /* BAMFont.cpp in Sources */,
A2A2EA3416A5EB630092B903 /* TTFFont.cpp in Sources */,
A2A2EA3816A5FC860092B903 /* Freetype.cpp in Sources */,
+ A2EC2F90176BD28E00FD960E /* BAMSprite2D.cpp in Sources */,
+ A2EC2F94176BD44C00FD960E /* SDLSurfaceSprite2D.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
@@ -53,10 +53,8 @@ Animation::Animation(int count)
Animation::~Animation(void)
{
- Video *video = core->GetVideoDriver();
-
for (unsigned int i = 0; i < indicesCount; i++) {
- video->FreeSprite( frames[i] );
+ frames[i]->release();
}
free(frames);
}
@@ -221,7 +219,7 @@ void Animation::MirrorAnimation()
for (size_t i = 0; i < indicesCount; i++) {
Sprite2D * tmp = frames[i];
frames[i] = video->MirrorSpriteHorizontal( tmp, true );
- video->FreeSprite(tmp);
+ tmp->release();
}
// flip animArea horizontally as well
@@ -235,7 +233,7 @@ void Animation::MirrorAnimationVert()
for (size_t i = 0; i < indicesCount; i++) {
Sprite2D * tmp = frames[i];
frames[i] = video->MirrorSpriteVertical( tmp, true );
- video->FreeSprite(tmp);
+ tmp->release();
}
// flip animArea vertically as well
@@ -24,7 +24,6 @@
#include "Interface.h"
#include "Sprite2D.h"
-#include "Video.h"
namespace GemRB {
@@ -39,7 +38,7 @@ AnimationFactory::AnimationFactory(const char* ResRef)
AnimationFactory::~AnimationFactory(void)
{
for (unsigned int i = 0; i < frames.size(); i++) {
- core->GetVideoDriver()->FreeSprite( frames[i] );
+ frames[i]->release();
}
if (FLTable)
free( FLTable);
@@ -127,8 +126,7 @@ Sprite2D* AnimationFactory::GetPaperdollImage(ieDword *Colors,
return NULL;
}
- Video* video = core->GetVideoDriver();
- Picture2 = video->DuplicateSprite(frames[1]);
+ Picture2 = frames[1]->copy();
if (!Picture2) {
return NULL;
}
@@ -142,8 +140,7 @@ Sprite2D* AnimationFactory::GetPaperdollImage(ieDword *Colors,
Picture2->XPos = (short)frames[1]->XPos;
Picture2->YPos = (short)frames[1]->YPos - 80;
-
- Sprite2D* spr = core->GetVideoDriver()->DuplicateSprite(frames[0]);
+ Sprite2D* spr = frames[0]->copy();
if (Colors) {
Palette* palette = spr->GetPalette();
palette->SetupPaperdollColours(Colors, type);
@@ -154,8 +151,6 @@ Sprite2D* AnimationFactory::GetPaperdollImage(ieDword *Colors,
spr->XPos = (short)frames[0]->XPos;
spr->YPos = (short)frames[0]->YPos;
- //don't free pixels, createsprite stores it in spr
-
return spr;
}
@@ -30,7 +30,6 @@
#include "Interface.h"
#include "Map.h"
#include "Palette.h"
-#include "Video.h"
namespace GemRB {
@@ -26,8 +26,6 @@
#include "GameData.h"
#include "GlobalTimer.h"
#include "Interface.h"
-#include "Palette.h" /* needed only for paperdoll palettes */
-#include "Video.h" /* needed only for paperdoll palettes */
#include "GUI/Button.h"
namespace GemRB {
@@ -1610,8 +1610,9 @@ void GameControl::UpdateScrolling() {
}
Sprite2D* cursor = core->GetScrollCursorSprite(cursorFrame, numScrollCursor);
- core->GetVideoDriver()->SetCursor(cursor, VID_CUR_DRAG);
- cursor->release();
+ Video* video = core->GetVideoDriver();
+ video->SetCursor(cursor, VID_CUR_DRAG);
+ video->FreeSprite(cursor);
numScrollCursor = (numScrollCursor+1) % 15;
}
@@ -21,7 +21,6 @@
#include "ImageFactory.h"
#include "Interface.h"
-#include "Video.h"
namespace GemRB {
@@ -33,7 +32,7 @@ ImageFactory::ImageFactory(const char* ResRef, Sprite2D* bitmap_)
ImageFactory::~ImageFactory(void)
{
- core->GetVideoDriver()->FreeSprite( bitmap );
+ bitmap->release();
}
Sprite2D* ImageFactory::GetSprite2D() const
View
@@ -24,7 +24,6 @@
#include "ImageFactory.h"
#include "Interface.h"
-#include "Video.h"
namespace GemRB {
@@ -55,7 +54,7 @@ Bitmap* ImageMgr::GetBitmap()
}
}
- core->GetVideoDriver()->FreeSprite(spr);
+ spr->release();
return data;
}
@@ -74,7 +73,7 @@ Image* ImageMgr::GetImage()
}
}
- core->GetVideoDriver()->FreeSprite(spr);
+ spr->release();
return data;
}
View
@@ -201,7 +201,6 @@ Interface::Interface()
TooltipDelay = 100;
IgnoreOriginalINI = 0;
Bpp = 32;
- FullScreen = 0;
GUIScriptsPath[0] = 0;
GamePath[0] = 0;
SavePath[0] = 0;
@@ -1128,16 +1127,9 @@ static const Region bg( 0, 0, 100, 30 );
/** this is the main loop */
void Interface::Main()
{
- ieDword brightness = 10;
- ieDword contrast = 5;
ieDword speed = 10;
- vars->Lookup("Full Screen", FullScreen);
- video->CreateDisplay( Width, Height, Bpp, FullScreen, GameName);
- vars->Lookup("Brightness Correction", brightness);
- vars->Lookup("Gamma Correction", contrast);
vars->Lookup("Mouse Scroll Speed", speed);
- video->SetGamma(brightness, contrast);
SetMouseScrollSpeed((int) speed);
if (vars->Lookup("Tooltips", TooltipDelay)) {
// the games store the slider position*10, not the actual delay
@@ -1503,6 +1495,7 @@ int Interface::Init(InterfaceConfig* config)
CONFIG_INT("EnableCheatKeys", EnableCheatKeys);
CONFIG_INT("EndianSwitch", DataStream::SetEndianSwitch);
CONFIG_INT("FogOfWar", FogOfWar = );
+ ieDword FullScreen = 0;
CONFIG_INT("FullScreen", FullScreen = );
vars->SetAt("Full Screen", FullScreen); //put into vars so that reading from game.ini wont overwrite
CONFIG_INT("GUIEnhancements", GUIEnhancements = );
@@ -1684,6 +1677,17 @@ int Interface::Init(InterfaceConfig* config)
Log(FATAL, "Core", "Cannot Initialize Video Driver.");
return GEM_ERROR;
}
+ ieDword brightness = 10;
+ ieDword contrast = 5;
+
+ // SDL2 driver requires the display to be created prior to sprite creation (opengl context)
+ // we also need the display to exist to create sprites using the display format
+ vars->Lookup("Full Screen", FullScreen);
+ video->CreateDisplay( Width, Height, Bpp, FullScreen, GameName);
+ vars->Lookup("Brightness Correction", brightness);
+ vars->Lookup("Gamma Correction", contrast);
+ video->SetGamma(brightness, contrast);
+
Color defcolor={255,255,255,200};
SetInfoTextColor(defcolor);
View
@@ -337,7 +337,6 @@ class GEM_EXPORT Interface
ieResRef ScrollCursorBam;
ieResRef GroundCircleBam[MAX_CIRCLE_SIZE];
int GroundCircleScale[MAX_CIRCLE_SIZE];
- ieDword FullScreen;
ieResRef TooltipFont;
ieResRef TooltipBackResRef;
ieResRef MovieFont;
@@ -33,7 +33,6 @@
#include "SaveGameMgr.h"
#include "Sprite2D.h"
#include "TableMgr.h"
-#include "Video.h"
#include "GUI/GameControl.h"
#include "Scriptable/Actor.h"
#include "System/FileStream.h"
@@ -33,7 +33,6 @@
#include "Spell.h"
#include "SpriteCover.h"
#include "TileMap.h"
-#include "Video.h"
#include "GameScript/GSUtils.h"
#include "GUI/GameControl.h"
#include "Scriptable/InfoPoint.h"
@@ -34,7 +34,6 @@
#include "Spell.h"
#include "SpriteCover.h"
#include "TileMap.h"
-#include "Video.h"
#include "GameScript/GSUtils.h"
#include "GUI/GameControl.h"
#include "System/StringBuffer.h"
Oops, something went wrong.

0 comments on commit 04f5148

Please sign in to comment.